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

thin: lvconvert warn before conversion

Warn user before converting volume to different type.

  WARNING: Converting vg/lvol0 logical volume to pool's meta/data volume.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)

Since the content of volume is lost we have to query user to confirm
such operation.  If user is 100% sure, he may use '--yes' to avoid prompts.
This commit is contained in:
Zdenek Kabelac 2014-05-20 16:21:14 +02:00
parent 83f468be4e
commit bbf4b2c1c9
2 changed files with 23 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
Prompt before converting volumes to thin pool and thin pool metadata.
Add dumpconfig --type profilable-{metadata,command} to select profile type.
Exit immediately with error if command profile is found invalid.
Separate --profile cmd line arg into --commandprofile and --metadataprofile.

View File

@ -2718,6 +2718,17 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
return 0;
}
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.)");
if (!lp->yes &&
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",
pool_lv->name,
(segtype_is_cache_pool(lp->segtype)) ?
@ -2825,6 +2836,17 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
return 0;
}
log_warn("WARNING: Converting \"%s/%s\" logical volume to pool's metadata volume.",
metadata_lv->vg->name, metadata_lv->name);
log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)");
if (!lp->yes &&
yes_no_prompt("Do you really want to convert \"%s/%s\"? [y|n]: ",
metadata_lv->vg->name, metadata_lv->name) == 'n') {
log_error("Conversion aborted.");
return 0;
}
lp->poolmetadata_size = metadata_lv->size;
max_metadata_size = (segtype_is_cache_pool(lp->segtype)) ?
DEFAULT_CACHE_POOL_MAX_METADATA_SIZE * 2 :