Skip to contentSkip to conversation

dev-mcsontos-clvmd-stack-overflow - vgchange: disable cluster convert for active LVs

PATCH Marian Csontos 1 participant 1 message Sep 16, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4a853361b01feda77031901eb2828c6ecabe760f
Commit:        4a853361b01feda77031901eb2828c6ecabe760f
Parent:        1ce21c19d5894b889a6d8da67c8a159709c3dda9
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Sep 16 11:41:28 2014 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Sep 16 11:42:41 2014 +0200

vgchange: disable cluster convert for active LVs

While we could probably reacquire some type of lock when going from non-clustered to clustered vg, we don't have any single road back to drop the lock and keep LV active.

For now keep it safe and prohibit conversion when LV is active in the VG.

---
 WHATS_NEW                    |    1 +
 lib/metadata/vg.c            |   42 +++++++++++++++++-------------------------
 test/shell/vgchange-usage.sh |   11 +++++++++++
 3 files changed, 29 insertions(+), 25 deletions(-)
WHATS_NEW +1 -0
index d3f926d..6c12186 100644
@@ -1,5 +1,6 @@
 Version 2.02.112 - 
 =====================================
+  Disable vgchange of clustered attribute with any active LV in VG.
   Use va_copy to properly pass va_list through functions.
   Add function to detect rotational devices.
   Review internal checks for mirror/raid/pvmove volumes.
lib/metadata/vg.c +17 -25

59 lines not on this page · raw message

test/shell/vgchange-usage.sh +11 -0
index 6ba3f69..ff80722 100644
@@ -89,16 +89,27 @@ fail vgchange -cy |& tee out
 grep "y/n" out
 check vg_attr_bit cluster $vg "-"
 
+lvcreate -l1 $vg
+
 # check on cluster
 # either skipped as clustered (non-cluster), or already clustered (on cluster)
 if test -e LOCAL_CLVMD ; then
+	# can't switch with active LV
+	not vgchange -cy $vg
+	lvchange -an $vg
 	vgchange -cy $vg
 	fail vgchange -cy $vg
 	check vg_attr_bit cluster $vg "c"
+	lvchange -ay $vg
+	not vgchange -cn $vg
+	lvchange -an $vg
 	vgchange -cn $vg
 else
 	# no clvmd is running
 	fail vgchange -cy $vg
+	# can't switch with active LV
+	not vgchange --yes -cy $vg
+	lvchange -an $vg
 	vgchange --yes -cy $vg
 	fail vgchange --yes -cy $vg
 	fail vgs $vg |& tee out