1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvconvert: thin conversion accept passed PVs

When creating thin pool or check pool there is allocated LV
for metadata and for such allocation user should be able to
specify list of PVs on cmdline.

Also fix unused passed list of PV for thick to thin conversion,
where the code was using whole PV set from a VG (but since it's
been not enabled on cmdline, user could not hit this issue).
Also remove unneeded initialization of use_pvh.
This commit is contained in:
Zdenek Kabelac 2023-08-31 18:44:53 +02:00
parent c693aa8dac
commit aa7f2ac954
2 changed files with 8 additions and 3 deletions

View File

@ -456,6 +456,7 @@ FLAGS: SECONDARY_SYNTAX
lvconvert --type thin --thinpool LV LV_linear_striped_raid_cache_thin_error_zero lvconvert --type thin --thinpool LV LV_linear_striped_raid_cache_thin_error_zero
OO: --thin, --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT OO: --thin, --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_thin_with_external ID: lvconvert_to_thin_with_external
DESC: Convert LV to a thin LV, using the original LV as an external origin. DESC: Convert LV to a thin LV, using the original LV as an external origin.
RULE: all and lv_is_visible RULE: all and lv_is_visible
@ -465,6 +466,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
# alternate form of lvconvert --type thin # alternate form of lvconvert --type thin
lvconvert --thin --thinpool LV LV_linear_striped_raid_cache_thin_error_zero lvconvert --thin --thinpool LV LV_linear_striped_raid_cache_thin_error_zero
OO: --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT OO: --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_thin_with_external ID: lvconvert_to_thin_with_external
DESC: Convert LV to a thin LV, using the original LV as an external origin. DESC: Convert LV to a thin LV, using the original LV as an external origin.
FLAGS: SECONDARY_SYNTAX FLAGS: SECONDARY_SYNTAX
@ -476,6 +478,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
# Convert to thin volume # Convert to thin volume
lvconvert --type thin LV_linear_striped_raid_cache_writecache_vdo_error_zero lvconvert --type thin LV_linear_striped_raid_cache_writecache_vdo_error_zero
OO: --thin, OO_LVCONVERT_POOL, OO_LVCONVERT OO: --thin, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_thin_with_data ID: lvconvert_to_thin_with_data
DESC: Convert LV to a thin LV, using LV as thin-pool data volume. DESC: Convert LV to a thin LV, using LV as thin-pool data volume.
RULE: all and lv_is_visible RULE: all and lv_is_visible
@ -485,6 +488,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
# Convert to thin volume # Convert to thin volume
lvconvert --thin LV_linear_striped_raid_cache_writecache_vdo_error_zero lvconvert --thin LV_linear_striped_raid_cache_writecache_vdo_error_zero
OO: OO_LVCONVERT_POOL, OO_LVCONVERT OO: OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_thin_with_data ID: lvconvert_to_thin_with_data
DESC: Convert LV to a thin LV, using LV as thin-pool data volume. DESC: Convert LV to a thin LV, using LV as thin-pool data volume.
FLAGS: SECONDARY_SYNTAX FLAGS: SECONDARY_SYNTAX
@ -497,6 +501,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
lvconvert --type cache --cachepool LV LV_linear_striped_raid_thinpool_vdo_vdopool_vdopooldata_thin_error_zero lvconvert --type cache --cachepool LV LV_linear_striped_raid_thinpool_vdo_vdopool_vdopooldata_thin_error_zero
OO: --cache, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT OO: --cache, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_cache_with_cachepool ID: lvconvert_to_cache_with_cachepool
DESC: Attach a cache pool to an LV, converts the LV to type cache. DESC: Attach a cache pool to an LV, converts the LV to type cache.
RULE: all not lv_is_locked lv_is_merging_origin lv_is_merging_cow lv_is_cow RULE: all not lv_is_locked lv_is_merging_origin lv_is_merging_cow lv_is_cow
@ -505,6 +510,7 @@ RULE: --poolmetadata not --readahead --stripesize --stripes_long
# alternate form of lvconvert --type cache # alternate form of lvconvert --type cache
lvconvert --cache --cachepool LV LV_linear_striped_raid_thinpool_vdo_vdopool_vdopooldata_thin_error_zero lvconvert --cache --cachepool LV LV_linear_striped_raid_thinpool_vdo_vdopool_vdopooldata_thin_error_zero
OO: OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT OO: OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
OP: PV ...
ID: lvconvert_to_cache_with_cachepool ID: lvconvert_to_cache_with_cachepool
DESC: Attach a cache pool to an LV. DESC: Attach a cache pool to an LV.
RULE: all not lv_is_locked lv_is_merging_origin lv_is_merging_cow lv_is_cow RULE: all not lv_is_locked lv_is_merging_origin lv_is_merging_cow lv_is_cow

View File

@ -4773,8 +4773,7 @@ static int _lvconvert_to_thin_with_data(struct cmd_context *cmd,
struct logical_volume *lv, struct logical_volume *lv,
struct processing_handle *handle) struct processing_handle *handle)
{ {
struct volume_group *vg = lv->vg; struct dm_list *use_pvh;
struct dm_list *use_pvh = NULL;
if (cmd->position_argc > 1) { if (cmd->position_argc > 1) {
/* First pos arg is required LV, remaining are optional PVs. */ /* First pos arg is required LV, remaining are optional PVs. */
@ -4784,7 +4783,7 @@ static int _lvconvert_to_thin_with_data(struct cmd_context *cmd,
} else } else
use_pvh = &lv->vg->pvs; use_pvh = &lv->vg->pvs;
if (!_lvconvert_to_pool(cmd, lv, lv, 1, 0, 1, &vg->pvs)) { if (!_lvconvert_to_pool(cmd, lv, lv, 1, 0, 1, use_pvh)) {
log_error("LV %s could not be converted to a thin volume.", log_error("LV %s could not be converted to a thin volume.",
display_lvname(lv)); display_lvname(lv));
return ECMD_FAILED; return ECMD_FAILED;