1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

cleanup: lvconvert display_lvname and indent updates

Use display_lvname() for printing vg/lv names.
Add some missing dots.
Some indents.
This commit is contained in:
Zdenek Kabelac 2016-07-12 11:05:34 +02:00
parent fd53d86eea
commit 5254971418

View File

@ -359,6 +359,7 @@ static int _read_pool_params(struct cmd_context *cmd, int *pargc, char ***pargv,
log_error("--cache requires --cachepool."); log_error("--cache requires --cachepool.");
return 0; return 0;
} }
if ((lp->cache || cachepool) && if ((lp->cache || cachepool) &&
!get_cache_params(cmd, &lp->cache_mode, &lp->policy_name, &lp->policy_settings)) { !get_cache_params(cmd, &lp->cache_mode, &lp->policy_name, &lp->policy_settings)) {
log_error("Failed to parse cache policy and/or settings."); log_error("Failed to parse cache policy and/or settings.");
@ -726,7 +727,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
if (arg_is_set(cmd, regionsize_ARG)) { if (arg_is_set(cmd, regionsize_ARG)) {
if (arg_sign_value(cmd, regionsize_ARG, SIGN_NONE) == if (arg_sign_value(cmd, regionsize_ARG, SIGN_NONE) ==
SIGN_MINUS) { SIGN_MINUS) {
log_error("Negative regionsize is invalid"); log_error("Negative regionsize is invalid.");
return 0; return 0;
} }
lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0); lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0);
@ -734,7 +735,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
region_size = get_default_region_size(cmd); region_size = get_default_region_size(cmd);
if (region_size < 0) { if (region_size < 0) {
log_error("Negative regionsize in " log_error("Negative regionsize in "
"configuration file is invalid"); "configuration file is invalid.");
return 0; return 0;
} }
lp->region_size = region_size; lp->region_size = region_size;
@ -743,14 +744,14 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
if (lp->region_size % (pagesize >> SECTOR_SHIFT)) { if (lp->region_size % (pagesize >> SECTOR_SHIFT)) {
log_error("Region size (%" PRIu32 ") must be " log_error("Region size (%" PRIu32 ") must be "
"a multiple of machine memory " "a multiple of machine memory "
"page size (%d)", "page size (%d).",
lp->region_size, pagesize >> SECTOR_SHIFT); lp->region_size, pagesize >> SECTOR_SHIFT);
return 0; return 0;
} }
if (!is_power_of_2(lp->region_size)) { if (!is_power_of_2(lp->region_size)) {
log_error("Region size (%" PRIu32 log_error("Region size (%" PRIu32
") must be a power of 2", lp->region_size); ") must be a power of 2.", lp->region_size);
return 0; return 0;
} }
@ -798,7 +799,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
if (activation() && lp->segtype && lp->segtype->ops->target_present && if (activation() && lp->segtype && lp->segtype->ops->target_present &&
!lp->segtype->ops->target_present(cmd, NULL, &lp->target_attr)) { !lp->segtype->ops->target_present(cmd, NULL, &lp->target_attr)) {
log_error("%s: Required device-mapper target(s) not " log_error("%s: Required device-mapper target(s) not "
"detected in your kernel", lp->segtype->name); "detected in your kernel.", lp->segtype->name);
return 0; return 0;
} }
@ -1326,11 +1327,11 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
* log daemon is multi-threaded. * log daemon is multi-threaded.
*/ */
if ((*new_log_count == MIRROR_LOG_MIRRORED) && vg_is_clustered(lv->vg)) { if ((*new_log_count == MIRROR_LOG_MIRRORED) && vg_is_clustered(lv->vg)) {
log_error("Log type, \"mirrored\", is unavailable to cluster mirrors"); log_error("Log type, \"mirrored\", is unavailable to cluster mirrors.");
return 0; return 0;
} }
log_verbose("Setting logging type to %s", get_mirror_log_name(*new_log_count)); log_verbose("Setting logging type to %s.", get_mirror_log_name(*new_log_count));
/* /*
* Region size must not change on existing mirrors * Region size must not change on existing mirrors
@ -1348,14 +1349,13 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
*/ */
if (lv_is_mirrored(lv) && dm_list_size(&lv->segments) != 1) { if (lv_is_mirrored(lv) && dm_list_size(&lv->segments) != 1) {
log_error("Logical volume %s has multiple " log_error("Logical volume %s has multiple "
"mirror segments.", lv->name); "mirror segments.", display_lvname(lv));
return 0; return 0;
} }
return 1; return 1;
} }
/* /*
* _lvconvert_mirrors_aux * _lvconvert_mirrors_aux
* *
@ -1378,7 +1378,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
if ((lp->mirrors == 1) && !lv_is_mirrored(lv)) { if ((lp->mirrors == 1) && !lv_is_mirrored(lv)) {
log_warn("Logical volume %s is already not mirrored.", log_warn("Logical volume %s is already not mirrored.",
lv->name); display_lvname(lv));
return 1; return 1;
} }
@ -1433,7 +1433,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
*/ */
if (lv_is_origin(lv)) { if (lv_is_origin(lv)) {
log_error("Can't add additional mirror images to " log_error("Can't add additional mirror images to "
"mirrors that are under snapshots"); "mirrors that are under snapshots,");
return 0; return 0;
} }
@ -1443,7 +1443,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
*/ */
if (find_temporary_mirror(lv) || lv_is_converting(lv)) { if (find_temporary_mirror(lv) || lv_is_converting(lv)) {
log_error("%s is already being converted. Unable to start another conversion.", log_error("%s is already being converted. Unable to start another conversion.",
lv->name); display_lvname(lv));
return 0; return 0;
} }
@ -1459,7 +1459,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
/* Insert a temporary layer for syncing, /* Insert a temporary layer for syncing,
* only if the original lv is using disk log. */ * only if the original lv is using disk log. */
if (seg->log_lv && !_insert_lvconvert_layer(cmd, lv)) { if (seg->log_lv && !_insert_lvconvert_layer(cmd, lv)) {
log_error("Failed to insert resync layer"); log_error("Failed to insert resync layer.");
return 0; return 0;
} }
@ -1477,7 +1477,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
!vg_commit(lv->vg)) { !vg_commit(lv->vg)) {
log_error("ABORTING: Failed to remove " log_error("ABORTING: Failed to remove "
"temporary mirror layer %s.", "temporary mirror layer %s.",
layer_lv->name); display_lvname(layer_lv));
log_error("Manual cleanup with vgcfgrestore " log_error("Manual cleanup with vgcfgrestore "
"and dmsetup may be required."); "and dmsetup may be required.");
return 0; return 0;
@ -1505,7 +1505,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
if (lp->keep_mimages) { if (lp->keep_mimages) {
if (arg_is_set(cmd, trackchanges_ARG)) { if (arg_is_set(cmd, trackchanges_ARG)) {
log_error("--trackchanges is not available " log_error("--trackchanges is not available "
"to 'mirror' segment type"); "to 'mirror' segment type.");
return 0; return 0;
} }
if (!lv_split_mirror_images(lv, lp->lv_split_name, if (!lv_split_mirror_images(lv, lp->lv_split_name,
@ -1692,6 +1692,7 @@ static int _lvconvert_validate_thin(struct logical_volume *lv,
display_lvname(seg_lv(first_seg(lv), 0))); display_lvname(seg_lv(first_seg(lv), 0)));
log_error("For pool metadata volume conversion use %s.", log_error("For pool metadata volume conversion use %s.",
display_lvname(first_seg(lv)->metadata_lv)); display_lvname(first_seg(lv)->metadata_lv));
return 0; return 0;
} }
@ -1713,7 +1714,7 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
if (lp->merge_mirror) { if (lp->merge_mirror) {
log_error("Unable to merge mirror images" log_error("Unable to merge mirror images"
"of segment type 'mirror'"); "of segment type 'mirror'.");
return 0; return 0;
} }
@ -1772,9 +1773,11 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
return 0; return 0;
if (!lp->need_polling) if (!lp->need_polling)
log_print_unless_silent("Logical volume %s converted.", lv->name); log_print_unless_silent("Logical volume %s converted.",
display_lvname(lv));
backup(lv->vg); backup(lv->vg);
return 1; return 1;
} }
@ -1845,7 +1848,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
/* Can only change image count for raid1 and linear */ /* Can only change image count for raid1 and linear */
if (lp->mirrors_supplied && !seg_is_mirrored(seg) && !seg_is_linear(seg)) { if (lp->mirrors_supplied && !seg_is_mirrored(seg) && !seg_is_linear(seg)) {
log_error("'--mirrors/-m' is not compatible with %s", log_error("'--mirrors/-m' is not compatible with %s.",
lvseg_name(seg)); lvseg_name(seg));
return 0; return 0;
} }
@ -1854,14 +1857,14 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
return_0; return_0;
if (!_is_valid_raid_conversion(seg->segtype, lp->segtype)) { if (!_is_valid_raid_conversion(seg->segtype, lp->segtype)) {
log_error("Unable to convert %s/%s from %s to %s", log_error("Unable to convert %s from %s to %s.",
lv->vg->name, lv->name, display_lvname(lv), lvseg_name(seg),
lvseg_name(seg), lp->segtype->name); lp->segtype->name);
return 0; return 0;
} }
if (seg_is_linear(seg) && !lp->merge_mirror && !lp->mirrors_supplied) { if (seg_is_linear(seg) && !lp->merge_mirror && !lp->mirrors_supplied) {
log_error("Raid conversions require -m/--mirrors"); log_error("Raid conversions require -m/--mirrors.");
return 0; return 0;
} }
@ -1876,7 +1879,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
image_count = lp->mirrors + 1; image_count = lp->mirrors + 1;
if (image_count < 1) { if (image_count < 1) {
log_error("Unable to %s images by specified amount", log_error("Unable to %s images by specified amount.",
lp->keep_mimages ? "split" : "reduce"); lp->keep_mimages ? "split" : "reduce");
return 0; return 0;
} }
@ -1904,7 +1907,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
} }
if (!lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, lp->stripes, lp->stripe_size, lp->pvh)) if (!lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, lp->stripes, lp->stripe_size, lp->pvh))
return_0; return_0;
log_print_unless_silent("Logical volume %s successfully converted", display_lvname(lv)); log_print_unless_silent("Logical volume %s successfully converted.",
display_lvname(lv));
return 1; return 1;
} }
@ -1913,8 +1917,8 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
if (lp->repair) { if (lp->repair) {
if (!lv_is_active_exclusive_locally(lv_lock_holder(lv))) { if (!lv_is_active_exclusive_locally(lv_lock_holder(lv))) {
log_error("%s/%s must be active %sto perform this" log_error("%s must be active %sto perform this operation.",
" operation.", lv->vg->name, lv->name, display_lvname(lv),
vg_is_clustered(lv->vg) ? vg_is_clustered(lv->vg) ?
"exclusive locally " : ""); "exclusive locally " : "");
return 0; return 0;
@ -1922,14 +1926,14 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
if (!seg_is_striped(seg) && !seg_is_any_raid0(seg) && if (!seg_is_striped(seg) && !seg_is_any_raid0(seg) &&
!lv_raid_percent(lv, &sync_percent)) { !lv_raid_percent(lv, &sync_percent)) {
log_error("Unable to determine sync status of %s/%s.", log_error("Unable to determine sync status of %s.",
lv->vg->name, lv->name); display_lvname(lv));
return 0; return 0;
} }
if (sync_percent != DM_PERCENT_100) { if (sync_percent != DM_PERCENT_100) {
log_warn("WARNING: %s/%s is not in-sync.", log_warn("WARNING: %s is not in-sync.",
lv->vg->name, lv->name); display_lvname(lv));
log_warn("WARNING: Portions of the array may be unrecoverable."); log_warn("WARNING: Portions of the array may be unrecoverable.");
/* /*
@ -1947,24 +1951,25 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
return_0; return_0;
if (!lv_raid_replace(lv, failed_pvs, lp->pvh)) { if (!lv_raid_replace(lv, failed_pvs, lp->pvh)) {
log_error("Failed to replace faulty devices in" log_error("Failed to replace faulty devices in %s.",
" %s/%s.", lv->vg->name, lv->name); display_lvname(lv));
return 0; return 0;
} }
log_print_unless_silent("Faulty devices in %s/%s successfully" log_print_unless_silent("Faulty devices in %s successfully"
" replaced.", lv->vg->name, lv->name); " replaced.", display_lvname(lv));
return 1; return 1;
} }
/* "warn" if policy not set to replace */ /* "warn" if policy not set to replace */
if (arg_is_set(cmd, usepolicies_ARG)) if (arg_is_set(cmd, usepolicies_ARG))
log_warn("Use 'lvconvert --repair %s/%s' to replace " log_warn("Use 'lvconvert --repair %s' to replace "
"failed device.", lv->vg->name, lv->name); "failed device.", display_lvname(lv));
return 1; return 1;
} }
log_error("Conversion operation not yet supported."); log_error("Conversion operation not yet supported.");
return 0; return 0;
} }
@ -2006,7 +2011,7 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
if (is_lockd_type(vg->lock_type)) { if (is_lockd_type(vg->lock_type)) {
/* FIXME: we need to create a lock for the new LV. */ /* FIXME: we need to create a lock for the new LV. */
log_error("Unable to split snapshots in VG with lock_type %s", vg->lock_type); log_error("Unable to split snapshots in VG with lock_type %s.", vg->lock_type);
return 0; return 0;
} }
@ -2213,7 +2218,7 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
} }
if (!lp->zero || !(lv->status & LVM_WRITE)) if (!lp->zero || !(lv->status & LVM_WRITE))
log_warn("WARNING: %s not zeroed", snap_name); log_warn("WARNING: %s not zeroed.", snap_name);
else { else {
lv->status |= LV_TEMPORARY; lv->status |= LV_TEMPORARY;
if (!activate_lv_local(cmd, lv) || if (!activate_lv_local(cmd, lv) ||
@ -2351,7 +2356,8 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd,
"next activation of %s.", "next activation of %s.",
display_lvname(lv), display_lvname(origin)); display_lvname(lv), display_lvname(origin));
else else
log_print_unless_silent("Merging of volume %s started.", lv->name); log_print_unless_silent("Merging of volume %s started.",
display_lvname(lv));
return 1; return 1;
} }
@ -2442,6 +2448,7 @@ out:
log_print_unless_silent("Merging of thin snapshot %s will occur on " log_print_unless_silent("Merging of thin snapshot %s will occur on "
"next activation of %s.", "next activation of %s.",
display_lvname(lv), display_lvname(origin)); display_lvname(lv), display_lvname(origin));
return r; return r;
} }
@ -2543,9 +2550,9 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,
} }
if (!(ret = exec_cmd(cmd, (const char * const *)argv, &status, 1))) { if (!(ret = exec_cmd(cmd, (const char * const *)argv, &status, 1))) {
log_error("Repair of thin metadata volume of thin pool %s/%s failed (status:%d). " log_error("Repair of thin metadata volume of thin pool %s failed (status:%d). "
"Manual repair required!", "Manual repair required!",
pool_lv->vg->name, pool_lv->name, status); display_lvname(pool_lv), status);
goto deactivate_mlv; goto deactivate_mlv;
} }
@ -2632,11 +2639,11 @@ deactivate_pmslv:
if (!vg_write(pool_lv->vg) || !vg_commit(pool_lv->vg)) if (!vg_write(pool_lv->vg) || !vg_commit(pool_lv->vg))
return_0; return_0;
log_warn("WARNING: If everything works, remove \"%s/%s\".", log_warn("WARNING: If everything works, remove %s volume.",
mlv->vg->name, mlv->name); display_lvname(mlv));
log_warn("WARNING: Use pvmove command to move \"%s/%s\" on the best fitting PV.", log_warn("WARNING: Use pvmove command to move %s on the best fitting PV.",
pool_lv->vg->name, first_seg(pool_lv)->metadata_lv->name); display_lvname(first_seg(pool_lv)->metadata_lv));
return 1; return 1;
} }
@ -3230,7 +3237,7 @@ mda_write:
"provisioning.", display_size(cmd, seg->chunk_size)); "provisioning.", display_size(cmd, seg->chunk_size));
if (activate_pool && !lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) { if (activate_pool && !lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
log_error("Failed to lock pool LV %s/%s", vg->name, pool_lv->name); log_error("Failed to lock pool LV %s.", display_lvname(pool_lv));
goto out; goto out;
} }
@ -3240,9 +3247,11 @@ mda_write:
display_lvname(pool_lv)); display_lvname(pool_lv));
/* Deactivate subvolumes */ /* Deactivate subvolumes */
if (!deactivate_lv(cmd, seg_lv(seg, 0))) if (!deactivate_lv(cmd, seg_lv(seg, 0)))
log_error("Failed to deactivate pool data logical volume."); log_error("Failed to deactivate pool data logical volume %s.",
display_lvname(seg_lv(seg, 0)));
if (!deactivate_lv(cmd, seg->metadata_lv)) if (!deactivate_lv(cmd, seg->metadata_lv))
log_error("Failed to deactivate pool metadata logical volume."); log_error("Failed to deactivate pool metadata logical volume %s.",
display_lvname(seg->metadata_lv));
goto out; goto out;
} }
@ -3350,7 +3359,6 @@ static int _lvconvert_cache(struct cmd_context *cmd,
* Separate a COW snapshot LV from its origin. * Separate a COW snapshot LV from its origin.
* lvconvert --splitsnapshot LV * lvconvert --splitsnapshot LV
*/ */
static int _convert_cow_snapshot_splitsnapshot(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cow_snapshot_splitsnapshot(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3361,7 +3369,6 @@ static int _convert_cow_snapshot_splitsnapshot(struct cmd_context *cmd, struct l
* Merge a COW snapshot LV into its origin. * Merge a COW snapshot LV into its origin.
* lvconvert --merge LV * lvconvert --merge LV
*/ */
static int _convert_cow_snapshot_merge(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cow_snapshot_merge(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3383,7 +3390,6 @@ static int _convert_thin_volume_merge(struct cmd_context *cmd, struct logical_vo
* Split and preserve a cache pool from the data portion of a thin pool LV. * Split and preserve a cache pool from the data portion of a thin pool LV.
* lvconvert --splitcache LV * lvconvert --splitcache LV
*/ */
static int _convert_thin_pool_splitcache(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_thin_pool_splitcache(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3403,7 +3409,6 @@ static int _convert_thin_pool_splitcache(struct cmd_context *cmd, struct logical
* Split and remove a cache pool from the data portion of a thin pool LV. * Split and remove a cache pool from the data portion of a thin pool LV.
* lvconvert --uncache LV * lvconvert --uncache LV
*/ */
static int _convert_thin_pool_uncache(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_thin_pool_uncache(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3423,7 +3428,6 @@ static int _convert_thin_pool_uncache(struct cmd_context *cmd, struct logical_vo
* Repair a thin pool LV. * Repair a thin pool LV.
* lvconvert --repair LV * lvconvert --repair LV
*/ */
static int _convert_thin_pool_repair(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_thin_pool_repair(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3443,7 +3447,6 @@ static int _convert_thin_pool_repair(struct cmd_context *cmd, struct logical_vol
* Alternate syntax: * Alternate syntax:
* lvconvert --cache LV * lvconvert --cache LV
*/ */
static int _convert_thin_pool_cache(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_thin_pool_cache(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3464,7 +3467,6 @@ static int _convert_thin_pool_cache(struct cmd_context *cmd, struct logical_volu
* FIXME: this will change so --swap-poolmetadata defines the operation. * FIXME: this will change so --swap-poolmetadata defines the operation.
* FIXME: should be lvconvert --swap-poolmetadata NewLV LV * FIXME: should be lvconvert --swap-poolmetadata NewLV LV
*/ */
static int _convert_thin_pool_swapmetadata(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_thin_pool_swapmetadata(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3475,7 +3477,6 @@ static int _convert_thin_pool_swapmetadata(struct cmd_context *cmd, struct logic
* Split and preserve a cache pool from a cache LV. * Split and preserve a cache pool from a cache LV.
* lvconvert --splitcache LV * lvconvert --splitcache LV
*/ */
static int _convert_cache_volume_splitcache(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cache_volume_splitcache(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3486,7 +3487,6 @@ static int _convert_cache_volume_splitcache(struct cmd_context *cmd, struct logi
* Split and remove a cache pool from a cache LV. * Split and remove a cache pool from a cache LV.
* lvconvert --uncache LV * lvconvert --uncache LV
*/ */
static int _convert_cache_volume_uncache(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cache_volume_uncache(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3500,7 +3500,6 @@ static int _convert_cache_volume_uncache(struct cmd_context *cmd, struct logical
* Required options: * Required options:
* --trackchanges | --name Name * --trackchanges | --name Name
*/ */
static int _convert_cache_volume_splitmirrors(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cache_volume_splitmirrors(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3526,7 +3525,6 @@ static int _convert_cache_volume_splitmirrors(struct cmd_context *cmd, struct lo
* This is equivalent to above, but not preferred because it's ambiguous and inconsistent. * This is equivalent to above, but not preferred because it's ambiguous and inconsistent.
* lvconvert --thinpool LV * lvconvert --thinpool LV
*/ */
static int _convert_cache_volume_thin_pool(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cache_volume_thin_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3537,7 +3535,6 @@ static int _convert_cache_volume_thin_pool(struct cmd_context *cmd, struct logic
* Split a cache volume from a cache pool LV. * Split a cache volume from a cache pool LV.
* lvconvert --splitcache LV * lvconvert --splitcache LV
*/ */
static int _convert_cache_pool_splitcache(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cache_pool_splitcache(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3569,7 +3566,6 @@ static int _convert_cache_pool_splitcache(struct cmd_context *cmd, struct logica
* FIXME: this will change so --swap-poolmetadata defines the operation. * FIXME: this will change so --swap-poolmetadata defines the operation.
* FIXME: should be lvconvert --swap-poolmetadata NewLV LV * FIXME: should be lvconvert --swap-poolmetadata NewLV LV
*/ */
static int _convert_cache_pool_swapmetadata(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cache_pool_swapmetadata(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3580,7 +3576,6 @@ static int _convert_cache_pool_swapmetadata(struct cmd_context *cmd, struct logi
* Change the number of images in a mirror LV. * Change the number of images in a mirror LV.
* lvconvert --mirrors Number LV * lvconvert --mirrors Number LV
*/ */
static int _convert_mirror_number(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_mirror_number(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3605,7 +3600,6 @@ static int _convert_mirror_splitmirrors(struct cmd_context *cmd, struct logical_
* Change the type of log used by a mirror LV. * Change the type of log used by a mirror LV.
* lvconvert --mirrorlog Type LV * lvconvert --mirrorlog Type LV
*/ */
static int _convert_mirror_log(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3619,7 +3613,6 @@ static int _convert_mirror_log(struct cmd_context *cmd, struct logical_volume *l
* Auxiliary operation: * Auxiliary operation:
* Removes missing, empty PVs from the VG, like vgreduce. * Removes missing, empty PVs from the VG, like vgreduce.
*/ */
static int _convert_mirror_repair(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_mirror_repair(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3643,7 +3636,6 @@ static int _convert_mirror_repair(struct cmd_context *cmd, struct logical_volume
* Alternate syntax: * Alternate syntax:
* lvconvert --mirrors 0 LV * lvconvert --mirrors 0 LV
*/ */
static int _convert_mirror_linear(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_mirror_linear(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3654,7 +3646,6 @@ static int _convert_mirror_linear(struct cmd_context *cmd, struct logical_volume
* Convert mirror LV to raid1 LV. * Convert mirror LV to raid1 LV.
* lvconvert --type raid1 LV * lvconvert --type raid1 LV
*/ */
static int _convert_mirror_raid(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_mirror_raid(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3665,7 +3656,6 @@ static int _convert_mirror_raid(struct cmd_context *cmd, struct logical_volume *
* Change the number of images in a raid1 LV. * Change the number of images in a raid1 LV.
* lvconvert --mirrors Number LV * lvconvert --mirrors Number LV
*/ */
static int _convert_raid_number(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_number(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3679,7 +3669,6 @@ static int _convert_raid_number(struct cmd_context *cmd, struct logical_volume *
* Required options: * Required options:
* --trackchanges | --name Name * --trackchanges | --name Name
*/ */
static int _convert_raid_splitmirrors(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_splitmirrors(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3692,7 +3681,6 @@ static int _convert_raid_splitmirrors(struct cmd_context *cmd, struct logical_vo
* previously split from the originalLV using --trackchanges. * previously split from the originalLV using --trackchanges.
* lvconvert --merge LV * lvconvert --merge LV
*/ */
static int _convert_raid_merge(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_merge(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3707,7 +3695,6 @@ static int _convert_raid_merge(struct cmd_context *cmd, struct logical_volume *l
* Auxiliary operation: * Auxiliary operation:
* Removes missing, empty PVs from the VG, like vgreduce. * Removes missing, empty PVs from the VG, like vgreduce.
*/ */
static int _convert_raid_repair(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_repair(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3729,7 +3716,6 @@ static int _convert_raid_repair(struct cmd_context *cmd, struct logical_volume *
* Replace a specific PV in a raid* LV with another PV. * Replace a specific PV in a raid* LV with another PV.
* lvconvert --replace PV LV * lvconvert --replace PV LV
*/ */
static int _convert_raid_replace(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_replace(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3745,7 +3731,6 @@ static int _convert_raid_replace(struct cmd_context *cmd, struct logical_volume
* Alternate syntax: * Alternate syntax:
* lvconvert --snapshot LV SnapshotLV * lvconvert --snapshot LV SnapshotLV
*/ */
static int _convert_raid_snapshot(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_snapshot(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3765,7 +3750,6 @@ static int _convert_raid_snapshot(struct cmd_context *cmd, struct logical_volume
* Alternate syntax: * Alternate syntax:
* lvconvert --thin LV * lvconvert --thin LV
*/ */
static int _convert_raid_thin(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_thin(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3791,7 +3775,6 @@ static int _convert_raid_thin(struct cmd_context *cmd, struct logical_volume *lv
* Alternate syntax: * Alternate syntax:
* lvconvert --cache LV * lvconvert --cache LV
*/ */
static int _convert_raid_cache(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_cache(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3812,7 +3795,6 @@ static int _convert_raid_cache(struct cmd_context *cmd, struct logical_volume *l
* This is equivalent to above, but not preferred because it's ambiguous and inconsistent. * This is equivalent to above, but not preferred because it's ambiguous and inconsistent.
* lvconvert --thinpool LV * lvconvert --thinpool LV
*/ */
static int _convert_raid_thin_pool(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_thin_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3823,7 +3805,6 @@ static int _convert_raid_thin_pool(struct cmd_context *cmd, struct logical_volum
* Convert a raid* LV to cache-pool LV. * Convert a raid* LV to cache-pool LV.
* lvconvert --type cache-pool LV * lvconvert --type cache-pool LV
*/ */
static int _convert_raid_cache_pool(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_cache_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3834,7 +3815,6 @@ static int _convert_raid_cache_pool(struct cmd_context *cmd, struct logical_volu
* Convert a raid* LV to use a different raid level. * Convert a raid* LV to use a different raid level.
* lvconvert --type raid* LV * lvconvert --type raid* LV
*/ */
static int _convert_raid_raid(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_raid(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3845,7 +3825,6 @@ static int _convert_raid_raid(struct cmd_context *cmd, struct logical_volume *lv
* Convert a raid* LV to a striped LV. * Convert a raid* LV to a striped LV.
* lvconvert --type striped LV * lvconvert --type striped LV
*/ */
static int _convert_raid_striped(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_striped(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3856,7 +3835,6 @@ static int _convert_raid_striped(struct cmd_context *cmd, struct logical_volume
* Convert a raid* LV to a linear LV. * Convert a raid* LV to a linear LV.
* lvconvert --type linear LV * lvconvert --type linear LV
*/ */
static int _convert_raid_linear(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_raid_linear(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3868,7 +3846,6 @@ static int _convert_raid_linear(struct cmd_context *cmd, struct logical_volume *
* previously split from the raid1 LV using --trackchanges. * previously split from the raid1 LV using --trackchanges.
* lvconvert --merge LV * lvconvert --merge LV
*/ */
static int _convert_striped_merge(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_striped_merge(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3883,7 +3860,6 @@ static int _convert_striped_merge(struct cmd_context *cmd, struct logical_volume
* Alternate syntax: * Alternate syntax:
* lvconvert --snapshot LV SnapshotLV * lvconvert --snapshot LV SnapshotLV
*/ */
static int _convert_striped_snapshot(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_striped_snapshot(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3903,7 +3879,6 @@ static int _convert_striped_snapshot(struct cmd_context *cmd, struct logical_vol
* Alternate syntax: * Alternate syntax:
* lvconvert --thin LV * lvconvert --thin LV
*/ */
static int _convert_striped_thin(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_striped_thin(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3950,7 +3925,6 @@ static int _convert_striped_cache(struct cmd_context *cmd, struct logical_volume
* This is equivalent to above, but not preferred because it's ambiguous and inconsistent. * This is equivalent to above, but not preferred because it's ambiguous and inconsistent.
* lvconvert --thinpool LV * lvconvert --thinpool LV
*/ */
static int _convert_striped_thin_pool(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_striped_thin_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3961,7 +3935,6 @@ static int _convert_striped_thin_pool(struct cmd_context *cmd, struct logical_vo
* Convert a striped/linear LV to a cache-pool LV. * Convert a striped/linear LV to a cache-pool LV.
* lvconvert --type cache-pool LV * lvconvert --type cache-pool LV
*/ */
static int _convert_striped_cache_pool(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_striped_cache_pool(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3979,7 +3952,6 @@ static int _convert_striped_cache_pool(struct cmd_context *cmd, struct logical_v
* This is equivalent to above when global/mirror_segtype_default="mirror". * This is equivalent to above when global/mirror_segtype_default="mirror".
* lvconvert --mirrors Number LV * lvconvert --mirrors Number LV
*/ */
static int _convert_striped_mirror(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_striped_mirror(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -3997,7 +3969,6 @@ static int _convert_striped_mirror(struct cmd_context *cmd, struct logical_volum
* This is equivalent to above when global/mirror_segtype_default="raid1". * This is equivalent to above when global/mirror_segtype_default="raid1".
* lvconvert --mirrors Number LV * lvconvert --mirrors Number LV
*/ */
static int _convert_striped_raid(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_striped_raid(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -4009,7 +3980,6 @@ static int _convert_striped_raid(struct cmd_context *cmd, struct logical_volume
* *
* _convert_<lvtype> * _convert_<lvtype>
*/ */
static int _convert_cow_snapshot(struct cmd_context *cmd, struct logical_volume *lv, static int _convert_cow_snapshot(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -4020,7 +3990,7 @@ static int _convert_cow_snapshot(struct cmd_context *cmd, struct logical_volume
if (arg_is_set(cmd, merge_ARG)) if (arg_is_set(cmd, merge_ARG))
return _convert_cow_snapshot_merge(cmd, lv, lp); return _convert_cow_snapshot_merge(cmd, lv, lp);
log_error("Operation not permitted on COW snapshot LV %s", display_lvname(lv)); log_error("Operation not permitted on COW snapshot LV %s.", display_lvname(lv));
log_error("Operations permitted on a COW snapshot LV are:\n" log_error("Operations permitted on a COW snapshot LV are:\n"
" --splitsnapshot\n" " --splitsnapshot\n"
" --merge\n"); " --merge\n");
@ -4034,7 +4004,7 @@ static int _convert_thin_volume(struct cmd_context *cmd, struct logical_volume *
if (arg_is_set(cmd, merge_ARG)) if (arg_is_set(cmd, merge_ARG))
return _convert_thin_volume_merge(cmd, lv, lp); return _convert_thin_volume_merge(cmd, lv, lp);
log_error("Operation not permitted on thin LV %s", display_lvname(lv)); log_error("Operation not permitted on thin LV %s.", display_lvname(lv));
log_error("Operations permitted on a thin LV are:\n" log_error("Operations permitted on a thin LV are:\n"
" --merge\n"); " --merge\n");
return 0; return 0;
@ -4068,7 +4038,7 @@ static int _convert_thin_pool(struct cmd_context *cmd, struct logical_volume *lv
/* FIXME: add --swapmetadata to list of permitted operations. */ /* FIXME: add --swapmetadata to list of permitted operations. */
log_error("Operation not permitted on thin pool LV %s", display_lvname(lv)); log_error("Operation not permitted on thin pool LV %s.", display_lvname(lv));
log_error("Operations permitted on a thin pool LV are:\n" log_error("Operations permitted on a thin pool LV are:\n"
" --splitcache (operates on cache sub LV)\n" " --splitcache (operates on cache sub LV)\n"
" --uncache (operates on cache sub LV)\n" " --uncache (operates on cache sub LV)\n"
@ -4103,7 +4073,7 @@ static int _convert_cache_volume(struct cmd_context *cmd, struct logical_volume
/* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */ /* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
log_error("Operation not permitted on cache LV %s", display_lvname(lv)); log_error("Operation not permitted on cache LV %s.", display_lvname(lv));
log_error("Operations permitted on a cache LV are:\n" log_error("Operations permitted on a cache LV are:\n"
" --splitcache\n" " --splitcache\n"
" --uncache\n" " --uncache\n"
@ -4129,7 +4099,7 @@ static int _convert_cache_pool(struct cmd_context *cmd, struct logical_volume *l
/* FIXME: add --swapmetadata to list of permitted operations. */ /* FIXME: add --swapmetadata to list of permitted operations. */
log_error("Operation not permitted on cache pool LV %s", display_lvname(lv)); log_error("Operation not permitted on cache pool LV %s.", display_lvname(lv));
log_error("Operations permitted on a cache pool LV are:\n" log_error("Operations permitted on a cache pool LV are:\n"
" --splitcache (operates on cache LV)\n"); " --splitcache (operates on cache LV)\n");
return 0; return 0;
@ -4179,7 +4149,7 @@ static int _convert_mirror(struct cmd_context *cmd, struct logical_volume *lv,
return 1; return 1;
} }
log_error("Operation not permitted on mirror LV %s", display_lvname(lv)); log_error("Operation not permitted on mirror LV %s.", display_lvname(lv));
log_error("Operations permitted on a mirror LV are:\n" log_error("Operations permitted on a mirror LV are:\n"
" --mirrors\n" " --mirrors\n"
" --splitmirrors\n" " --splitmirrors\n"
@ -4187,6 +4157,7 @@ static int _convert_mirror(struct cmd_context *cmd, struct logical_volume *lv,
" --repair\n" " --repair\n"
" --type linear\n" " --type linear\n"
" --type raid*\n"); " --type raid*\n");
return 0; return 0;
} }
@ -4242,7 +4213,7 @@ static int _convert_raid(struct cmd_context *cmd, struct logical_volume *lv,
/* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */ /* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
log_error("Operation not permitted on raid LV %s", display_lvname(lv)); log_error("Operation not permitted on raid LV %s.", display_lvname(lv));
log_error("Operations permitted on a raid LV are:\n" log_error("Operations permitted on a raid LV are:\n"
" --mirrors\n" " --mirrors\n"
" --splitmirrors\n" " --splitmirrors\n"
@ -4307,7 +4278,7 @@ static int _convert_striped(struct cmd_context *cmd, struct logical_volume *lv,
/* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */ /* The --thinpool alternative for --type thin-pool is not preferred, so not shown. */
log_error("Operation not permitted on striped or linear LV %s", display_lvname(lv)); log_error("Operation not permitted on striped or linear LV %s.", display_lvname(lv));
log_error("Operations permitted on a striped or linear LV are:\n" log_error("Operations permitted on a striped or linear LV are:\n"
" --merge\n" " --merge\n"
" --type snapshot\n" " --type snapshot\n"
@ -4317,6 +4288,7 @@ static int _convert_striped(struct cmd_context *cmd, struct logical_volume *lv,
" --type cache-pool\n" " --type cache-pool\n"
" --type mirror\n" " --type mirror\n"
" --type raid*\n"); " --type raid*\n");
return 0; return 0;
} }
@ -4332,7 +4304,6 @@ static int _convert_striped(struct cmd_context *cmd, struct logical_volume *lv,
* _convert_lvtype_operation(); * _convert_lvtype_operation();
* *
*/ */
static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv, static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
@ -4433,7 +4404,6 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
out: out:
return ret ? ECMD_PROCESSED : ECMD_FAILED; return ret ? ECMD_PROCESSED : ECMD_FAILED;
} }
static struct convert_poll_id_list* _convert_poll_id_list_create(struct cmd_context *cmd, static struct convert_poll_id_list* _convert_poll_id_list_create(struct cmd_context *cmd,
@ -4488,7 +4458,7 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
struct volume_group *vg = lv->vg; struct volume_group *vg = lv->vg;
if (test_mode() && is_lockd_type(vg->lock_type)) { if (test_mode() && is_lockd_type(vg->lock_type)) {
log_error("Test mode is not yet supported with lock type %s", log_error("Test mode is not yet supported with lock type %s.",
vg->lock_type); vg->lock_type);
return ECMD_FAILED; return ECMD_FAILED;
} }