]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: tune cache-pool zeroing
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 23 Jul 2016 19:17:56 +0000 (21:17 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 27 Jul 2016 14:20:57 +0000 (16:20 +0200)
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).

WHATS_NEW
tools/lvconvert.c

index abd9fb8eb2dce40202277ce2d4aa6a257ffb597e..5c09a1f86333e414323f74df08e406708749e28d 100644 (file)
--- 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
index be7425f1ec6a2ab77d904ddae96a98ef4c14810f..f3586b285ebc8f7a313d5f628cec0510f3a0ef6f 100644 (file)
@@ -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)
This page took 0.051974 seconds and 5 git commands to generate.