mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
lvconvert: preserve names of converted LV
When prompting and warning for conversion, remember initial LV names, so after conversion is finished, correct original names are printed.
This commit is contained in:
parent
d6f4563103
commit
de58df390b
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.176 -
|
Version 2.02.176 -
|
||||||
===================================
|
===================================
|
||||||
|
Show original converted names when lvconverting LV to pool volume.
|
||||||
Move lib code used only by liblvm into metadata-liblvm.c.
|
Move lib code used only by liblvm into metadata-liblvm.c.
|
||||||
Distinguish between device not found and excluded by filter.
|
Distinguish between device not found and excluded by filter.
|
||||||
Monitor external origin LVs.
|
Monitor external origin LVs.
|
||||||
|
@ -2864,6 +2864,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
|||||||
const char *pool_name; /* name of original lv arg */
|
const char *pool_name; /* name of original lv arg */
|
||||||
char meta_name[NAME_LEN]; /* generated sub lv name */
|
char meta_name[NAME_LEN]; /* generated sub lv name */
|
||||||
char data_name[NAME_LEN]; /* generated sub lv name */
|
char data_name[NAME_LEN]; /* generated sub lv name */
|
||||||
|
char converted_names[3*NAME_LEN]; /* preserve names of converted lv */
|
||||||
struct segment_type *pool_segtype; /* thinpool or cachepool */
|
struct segment_type *pool_segtype; /* thinpool or cachepool */
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
unsigned int target_attr = ~0;
|
unsigned int target_attr = ~0;
|
||||||
@ -3052,14 +3053,16 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
|||||||
|
|
||||||
log_verbose("Pool metadata extents %u chunk_size %u", meta_extents, chunk_size);
|
log_verbose("Pool metadata extents %u chunk_size %u", meta_extents, chunk_size);
|
||||||
|
|
||||||
|
(void) dm_snprintf(converted_names, sizeof(converted_names), "%s%s%s",
|
||||||
|
display_lvname(lv),
|
||||||
|
metadata_lv ? " and " : "",
|
||||||
|
metadata_lv ? display_lvname(metadata_lv) : "");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify that user wants to use these LVs.
|
* Verify that user wants to use these LVs.
|
||||||
*/
|
*/
|
||||||
|
log_warn("WARNING: Converting %s to %s pool's data%s %s metadata wiping.",
|
||||||
log_warn("WARNING: Converting logical volume %s%s%s to %s pool's data%s %s metadata wiping.",
|
converted_names,
|
||||||
display_lvname(lv),
|
|
||||||
metadata_lv ? " and " : "",
|
|
||||||
metadata_lv ? display_lvname(metadata_lv) : "",
|
|
||||||
to_cachepool ? "cache" : "thin",
|
to_cachepool ? "cache" : "thin",
|
||||||
metadata_lv ? " and metadata volumes" : " volume",
|
metadata_lv ? " and metadata volumes" : " volume",
|
||||||
zero_metadata ? "with" : "WITHOUT");
|
zero_metadata ? "with" : "WITHOUT");
|
||||||
@ -3070,10 +3073,8 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
|||||||
log_warn("WARNING: Using mismatched cache pool metadata MAY DESTROY YOUR DATA!");
|
log_warn("WARNING: Using mismatched cache pool metadata MAY DESTROY YOUR DATA!");
|
||||||
|
|
||||||
if (!arg_count(cmd, yes_ARG) &&
|
if (!arg_count(cmd, yes_ARG) &&
|
||||||
yes_no_prompt("Do you really want to convert %s%s%s? [y/n]: ",
|
yes_no_prompt("Do you really want to convert %s? [y/n]: ",
|
||||||
display_lvname(lv),
|
converted_names) == 'n') {
|
||||||
metadata_lv ? " and " : "",
|
|
||||||
metadata_lv ? display_lvname(metadata_lv) : "") == 'n') {
|
|
||||||
log_error("Conversion aborted.");
|
log_error("Conversion aborted.");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
@ -3289,8 +3290,7 @@ out:
|
|||||||
|
|
||||||
if (r)
|
if (r)
|
||||||
log_print_unless_silent("Converted %s to %s pool.",
|
log_print_unless_silent("Converted %s to %s pool.",
|
||||||
display_lvname(lv),
|
converted_names, to_cachepool ? "cache" : "thin");
|
||||||
to_cachepool ? "cache" : "thin");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unlock and free the locks from existing LVs that became pool data
|
* Unlock and free the locks from existing LVs that became pool data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user