]> sourceware.org Git - lvm2.git/commitdiff
lv_manip: fix regresion from bf2741376d4
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 21 Nov 2012 08:46:18 +0000 (09:46 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 21 Nov 2012 11:15:09 +0000 (12:15 +0100)
Commit bf2741376d47411994d4065863acab8e405ff5c7 started to use
lv_is_active() instead of call for lv_info & info.exists so
we cover also cluster activated devices.
For snapshost the conversion was not correct and introduced
regression by blocking creation of snapshot of inactive LV.

Fix it by assigning lv_is_active() directly.
Note: we still have minor issue to fix - to make
lv_is_???? function able to return error states since
lv_info() may fail.

lib/metadata/lv_manip.c
test/shell/lvcreate-usage.sh

index dc315aca371e8688564e461f45fd6a1611714976..35a75ffd55c38013bc84694faa8b54348391ebea 100644 (file)
@@ -4367,14 +4367,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
                                log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
                        }
 
-                       if (!lv_is_active(org)) {
-                               log_error("Check for existence of active snapshot "
-                                         "origin '%s' failed.", org->name);
-                               return NULL;
-                       }
-                       origin_active = 1;
-
-                       if (vg_is_clustered(vg) &&
+                       if ((origin_active = lv_is_active(org)) &&
+                           vg_is_clustered(vg) &&
                            !lv_is_active_exclusive_locally(org)) {
                                log_error("%s must be active exclusively to"
                                          " create snapshot", org->name);
index ddde401acb58f9d23eff4117c7f790ba424e85e2..c9c906abcbb66d6cd7de3c98f1846a5abb708aa2 100644 (file)
@@ -64,6 +64,8 @@ lvcreate -l1 -n $lv3 $vg
 not lvcreate -l1 -n $lv4 $vg
 
 lvremove -ff $vg/$lv3
+# check snapshot of inactive origin
+lvchange -an $vg/$lv1
 lvcreate -l1 -s -n $lv3 $vg/$lv1
 not lvcreate -l1 -n $lv4 $vg
 not lvcreate -l1 -m1 -n $lv4 $vg
This page took 0.050686 seconds and 5 git commands to generate.