1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lv_manip: fix regresion from bf2741376d

Commit bf2741376d 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.
This commit is contained in:
Zdenek Kabelac 2012-11-21 09:46:18 +01:00
parent d5697b29ee
commit 400f644286
2 changed files with 4 additions and 8 deletions

View 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."); log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
} }
if (!lv_is_active(org)) { if ((origin_active = lv_is_active(org)) &&
log_error("Check for existence of active snapshot " vg_is_clustered(vg) &&
"origin '%s' failed.", org->name);
return NULL;
}
origin_active = 1;
if (vg_is_clustered(vg) &&
!lv_is_active_exclusive_locally(org)) { !lv_is_active_exclusive_locally(org)) {
log_error("%s must be active exclusively to" log_error("%s must be active exclusively to"
" create snapshot", org->name); " create snapshot", org->name);

View File

@ -64,6 +64,8 @@ lvcreate -l1 -n $lv3 $vg
not lvcreate -l1 -n $lv4 $vg not lvcreate -l1 -n $lv4 $vg
lvremove -ff $vg/$lv3 lvremove -ff $vg/$lv3
# check snapshot of inactive origin
lvchange -an $vg/$lv1
lvcreate -l1 -s -n $lv3 $vg/$lv1 lvcreate -l1 -s -n $lv3 $vg/$lv1
not lvcreate -l1 -n $lv4 $vg not lvcreate -l1 -n $lv4 $vg
not lvcreate -l1 -m1 -n $lv4 $vg not lvcreate -l1 -m1 -n $lv4 $vg