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

lvconvert: print warning when not convert thinpool

Warning about destruction should not be printed,
When we are converting already existing pool
(improving original in-release commit bbf4b2c1c9)
This commit is contained in:
Zdenek Kabelac 2014-06-18 14:18:13 +02:00
parent 21964f47d5
commit e6a4cc9c31

View File

@ -2708,22 +2708,24 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
return 0; return 0;
} }
if (lv_is_thin_pool(pool_lv) && pool_is_active(pool_lv)) { if (lv_is_thin_pool(pool_lv)) {
if (pool_is_active(pool_lv)) {
/* If any thin volume is also active - abort here */ /* If any thin volume is also active - abort here */
log_error("Cannot convert pool %s/%s with active thin volumes.", log_error("Cannot convert pool %s/%s with active thin volumes.",
pool_lv->vg->name, pool_lv->name); pool_lv->vg->name, pool_lv->name);
return 0; return 0;
} }
} else {
log_warn("WARNING: Converting \"%s/%s\" logical volume to pool's data volume.",
pool_lv->vg->name, pool_lv->name);
log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)");
log_warn("WARNING: Converting \"%s/%s\" logical volume to pool's data volume.", if (!lp->yes &&
pool_lv->vg->name, pool_lv->name); yes_no_prompt("Do you really want to convert \"%s/%s\"? [y/n]: ",
log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)"); pool_lv->vg->name, pool_lv->name) == 'n') {
log_error("Conversion aborted.");
if (!lp->yes && return 0;
yes_no_prompt("Do you really want to convert \"%s/%s\"? [y/n]: ", }
pool_lv->vg->name, pool_lv->name) == 'n') {
log_error("Conversion aborted.");
return 0;
} }
if ((dm_snprintf(metadata_name, sizeof(metadata_name), "%s%s", if ((dm_snprintf(metadata_name, sizeof(metadata_name), "%s%s",