mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvconvert: tune cache-pool zeroing
Follow-up to 27a767d5e8
.
Tunning behavior in a way we always prompt when option --zero is NOT specified.
Without -Z lvm expects user wants to 'reset' cache-pool metadata
(they could have been splitted from some cached LV)
If user doesn't want to zero metadata he needs to specify -Zn.
User may also avoid prompting for zeroing by using -Zy for
cache-pool (basically equals using --yes without -Z being given)
(unlike full convert case, there is no cache-pool being converted,
so there is not 'uncoditional' prompt in this case).
This commit is contained in:
parent
5636bfd83d
commit
3c377f8334
@ -5,7 +5,7 @@ Version 2.02.162 -
|
||||
Improve lvconvert --trackchanges validation to require --splitmirrors 1.
|
||||
Add note about lastlog built-in command to lvm man page.
|
||||
Fix unrecognised segtype flag message.
|
||||
lvconvert reuse cachepool metadade now ONLY with -Zn and clear otherwise.
|
||||
lvconvert not clears cache pool metadata ONLY with -Zn.
|
||||
Enabled lvconvert --uncache to work with partial VG.
|
||||
|
||||
Version 2.02.161 - 15th July 2016
|
||||
|
@ -2998,24 +2998,28 @@ static int _lvconvert_pool(struct cmd_context *cmd,
|
||||
return_0;
|
||||
|
||||
if (lp->cache) {
|
||||
/* Check is user has not requested -Zn */
|
||||
if (!arg_int_value(cmd, zero_ARG, 1)) {
|
||||
/* Note: requires rather deep know-how to skip zeroing
|
||||
* so show major warnings */
|
||||
log_warn("WARNING: Reusing old cache pool metadata %s to "
|
||||
"for volume caching.",
|
||||
display_lvname(pool_lv));
|
||||
log_warn("THIS MAY DESTROY YOUR DATA (filesystem etc.)");
|
||||
|
||||
/* Check is user requested zeroing logic via [-Z y|n] */
|
||||
if (!arg_is_set(cmd, zero_ARG)) {
|
||||
/* Note: requires rather deep know-how to skip zeroing */
|
||||
if (!lp->yes &&
|
||||
yes_no_prompt("Do you really want to keep old metadata for "
|
||||
yes_no_prompt("Do you want wipe existing metadata of "
|
||||
"cache pool volume %s? [y/n]: ",
|
||||
display_lvname(pool_lv)) == 'n') {
|
||||
log_error("Conversion aborted.");
|
||||
log_error("To preserve cache metadata add option \"--zero n\".");
|
||||
log_warn("WARNING: Reusing mismatched cache pool metadata "
|
||||
"MAY DESTROY YOUR DATA!");
|
||||
return 0;
|
||||
}
|
||||
} else if (!wipe_cache_pool(pool_lv))
|
||||
return_0;
|
||||
/* Wiping confirmed, go ahead */
|
||||
if (!wipe_cache_pool(pool_lv))
|
||||
return_0;
|
||||
} else if (arg_int_value(cmd, zero_ARG, 0)) {
|
||||
if (!wipe_cache_pool(pool_lv)) /* Wipe according to -Z y|n */
|
||||
return_0;
|
||||
} else
|
||||
log_warn("WARNING: Reusing cache pool metadata %s "
|
||||
"for volume caching.", display_lvname(pool_lv));
|
||||
}
|
||||
|
||||
if (lp->thin || lp->cache)
|
||||
|
Loading…
Reference in New Issue
Block a user