1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-23 13:57:47 +03:00

lvconvert: add support --setactivationskip

When repair thinpool or cachepool, lvm2 leaves original metadata
volume backup. To avoid potential damage of those data, mark such
volume as 'read-only' and also allow user to use --setactivationskip
option for this volume.

TODO: likely better default would be to automatically skip, but
that might need some more thinking about recovery reporting doc.
This commit is contained in:
Zdenek Kabelac 2023-07-17 12:13:14 +02:00
parent d040b68aee
commit f078ffc5e6
3 changed files with 24 additions and 1 deletions

View File

@ -120,6 +120,8 @@ lvconvert \(em Change logical volume layout
\fB--repair\fP
.br
\fB--replace\fP \fIPV\fP
.br
\fB-k\fP|\fB--setactivationskip\fP \fBy\fP|\fBn\fP
.br
\fB-s\fP|\fB--snapshot\fP
.br
@ -882,6 +884,8 @@ Repair a cache pool.
.ad l
[ \fB-i\fP|\fB--interval\fP \fINumber\fP ]
.br
[ \fB-k\fP|\fB--setactivationskip\fP \fBy\fP|\fBn\fP ]
.br
[ \fB--usepolicies\fP ]
.br
[ \fB--poolmetadataspare\fP \fBy\fP|\fBn\fP ]
@ -1446,6 +1450,16 @@ Multiple PVs can be replaced by repeating this option.
See \fBlvmraid\fP(7) for more information.
.
.HP
\fB-k\fP|\fB--setactivationskip\fP \fBy\fP|\fBn\fP
.br
Persistently sets (yes) or clears (no) the "activation skip" flag on an LV.
An LV with this flag set is not activated unless the
--ignoreactivationskip option is used by the activation command.
This flag is set by default on new thin snapshot LVs.
The flag is not applied to deactivation.
The current value of the flag is indicated in the lvs lv_attr bits.
.
.HP
\fB-s\fP|\fB--snapshot\fP
.br
Combine a former COW snapshot LV with a former origin LV to reverse

View File

@ -795,7 +795,7 @@ AUTOTYPE: snapshot
# and the LV type is known.
lvconvert --repair LV_cache_cachepool_mirror_raid_thinpool
OO: --usepolicies, --interval Number, --poolmetadataspare Bool, OO_LVCONVERT
OO: --usepolicies, --interval Number, --setactivationskip Bool, --poolmetadataspare Bool, OO_LVCONVERT
OP: PV ...
ID: lvconvert_repair
DESC: Replace failed PVs in a raid or mirror LV.
@ -803,6 +803,7 @@ DESC: Repair a thin pool.
DESC: Repair a cache pool.
RULE: all not lv_is_locked lv_is_pvmove
RULE: --poolmetadataspare and LV_cache LV_cachepool LV_thinpool
RULE: --setactivationskip and LV_cache LV_cachepool LV_thinpool
lvconvert --replace PV LV_raid
OO: OO_LVCONVERT

View File

@ -2485,6 +2485,10 @@ deactivate_pmslv:
if (!detach_pool_metadata_lv(first_seg(pool_lv), &mlv))
return_0;
/* TODO: change default to skip */
lv_set_activation_skip(mlv, 1, arg_int_value(cmd, setactivationskip_ARG, 0));
mlv->status &= ~LVM_WRITE; /* read-only metadata backup */
/* Swap _pmspare and _tmeta name */
if (!swap_lv_identifiers(cmd, mlv, pmslv))
return_0;
@ -2650,6 +2654,10 @@ deactivate_pmslv:
if (!detach_pool_metadata_lv(first_seg(pool_lv), &mlv))
return_0;
/* TODO: change default to skip */
lv_set_activation_skip(mlv, 1, arg_int_value(cmd, setactivationskip_ARG, 0));
mlv->status &= ~LVM_WRITE; /* read-only metadata backup */
/* Swap _pmspare and _cmeta name */
if (!swap_lv_identifiers(cmd, mlv, pmslv))
return_0;