summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-07-23 21:17:56 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2016-07-27 16:20:57 +0200
commit3c377f8334491421207ae91094e9d7b3be0a300f (patch)
tree00d48b6f652239c58b5acab76f0d82a079f59147
parent5636bfd83d54f119d313603f4f9070bf0dfba2fe (diff)
downloadlvm2-3c377f8334491421207ae91094e9d7b3be0a300f.tar.gz
lvconvert: tune cache-pool zeroing
Follow-up to 27a767d5e8cedf9cac31eb3562cf8fdd4aa88b7c. 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).
-rw-r--r--WHATS_NEW2
-rw-r--r--tools/lvconvert.c28
2 files changed, 17 insertions, 13 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index abd9fb8eb..5c09a1f86 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index be7425f1e..f3586b285 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -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)