]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: cache and thin conversion validation
authorZdenek Kabelac <zkabelac@redhat.com>
Mon, 6 Oct 2014 11:44:59 +0000 (13:44 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 6 Oct 2014 13:18:06 +0000 (15:18 +0200)
More test for supported conversion.

WHATS_NEW
tools/lvconvert.c

index 980809c4e137de34ffef79fbbd9ea88656f97c8d..5fc42d6697296064560b2c1d26f6c49a04082554 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.112 - 
 =====================================
+  Fix detection of unsupported cache and thin pool lvconversions.
   Fix detection of unsupported lvconversion of cache to snapshot.
   Improve code for creation of cache and cache pool volumes.
   Check cluster-wide (not local) active status before removing LV.
index 1a5d55997830a206cef0d150c47ef66f55d635fb..36fafbeaf73f8e788bf8dfa78c43db4ef58ddacc 100644 (file)
@@ -2802,13 +2802,18 @@ static int _lvconvert_pool(struct cmd_context *cmd,
        }
 
        if (lv_is_thin_pool(pool_lv) && (segtype_is_cache_pool(lp->segtype) || lp->cache)) {
-               log_error("Cannot convert thin pool volume %s as cache pool data volume.",
+               log_error("Can't convert thin pool LV %s.", display_lvname(pool_lv));
+               return 0;
+       }
+
+       if (lv_is_cache(pool_lv) && !segtype_is_thin_pool(lp->segtype)) {
+               log_error("Cached LV %s could be only converted into a thin pool volume.",
                          display_lvname(pool_lv));
                return 0;
        }
 
        if (lv_is_cache_pool(pool_lv) && (segtype_is_thin_pool(lp->segtype) || lp->thin)) {
-               log_error("Cannot convert cache pool %s as thin pool data volume.",
+               log_error("Cannot convert cache pool %s as pool data volume.",
                          display_lvname(pool_lv));
                return 0;
        }
@@ -3250,6 +3255,25 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
                return ECMD_PROCESSED;
        }
 
+       if (lp->cache) {
+               if (lv_is_thin_pool(lv))
+                       lv = seg_lv(first_seg(lv), 0); /* cache _tdata */
+               if (!validate_lv_cache_create(NULL, lv))
+                       return_ECMD_FAILED;
+       }
+
+       if (lp->thin) {
+               if (lv_is_cache_type(lv) ||
+                   lv_is_pool(lv) ||
+                   lv_is_thin_pool_data(lv) ||
+                   lv_is_thin_pool_metadata(lv)) {
+                       log_error("Can't convert %s %s to external origin.",
+                                 first_seg(lv)->segtype->name,
+                                 display_lvname(lv));
+                       return ECMD_FAILED;
+               }
+       }
+
        if (arg_count(cmd, repair_ARG)) {
                if (lv_is_pool(lv)) {
                        if (!_lvconvert_pool_repair(cmd, lv, lp))
This page took 0.061272 seconds and 5 git commands to generate.