summaryrefslogtreecommitdiff
path: root/test/shell/inconsistent-metadata.sh
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2013-03-05 01:47:43 -0800
committerAnas Nashif <anas.nashif@intel.com>2013-03-05 01:47:43 -0800
commit44a3c2255bc480c82f34db156553a595606d8a0b (patch)
tree5e6df96a6c6e40207cb3a711860e16b543918c0d /test/shell/inconsistent-metadata.sh
parent8bd28eea831fd5215c12e6fcecc8e9a772398ed9 (diff)
downloaddevice-mapper-44a3c2255bc480c82f34db156553a595606d8a0b.tar.gz
device-mapper-44a3c2255bc480c82f34db156553a595606d8a0b.tar.bz2
device-mapper-44a3c2255bc480c82f34db156553a595606d8a0b.zip
Imported Upstream version 2.02.98upstream/2.02.98upstream/1.02.77
Diffstat (limited to 'test/shell/inconsistent-metadata.sh')
-rw-r--r--test/shell/inconsistent-metadata.sh80
1 files changed, 80 insertions, 0 deletions
diff --git a/test/shell/inconsistent-metadata.sh b/test/shell/inconsistent-metadata.sh
new file mode 100644
index 0000000..9f4ffd2
--- /dev/null
+++ b/test/shell/inconsistent-metadata.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+aux prepare_vg 3 12
+
+lvcreate -m 1 -l 1 -n mirror $vg
+lvcreate -l 1 -n resized $vg
+lvchange -a n $vg/mirror
+
+aux backup_dev $(cat DEVICES)
+
+init() {
+ aux restore_dev $(cat DEVICES)
+ lvs -o lv_name,lv_size --units k $vg | tee lvs.out
+ grep resized lvs.out | not grep 8192
+ lvresize -L 8192K $vg/resized
+ aux restore_dev "$dev1"
+}
+
+check() {
+ lvs -o lv_name,lv_size --units k $vg | tee lvs.out
+ grep resized lvs.out | grep 8192
+}
+
+# vgscan fixes up metadata (needs --cache option for direct scan if lvmetad is used)
+test -e LOCAL_LVMETAD && cache="--cache"
+init
+vgscan $cache 2>&1 | tee cmd.out
+grep "Inconsistent metadata found for VG $vg" cmd.out
+test -e LOCAL_LVMETAD && vgrename $vg foo && vgrename foo $vg # trigger a write
+vgscan $cache 2>&1 | tee cmd.out
+not grep "Inconsistent metadata found for VG $vg" cmd.out
+check
+
+# only vgscan would have noticed metadata inconsistencies when lvmetad is active
+if !test -e LOCAL_LVMETAD; then
+ # vgdisplay fixes
+ init
+ vgdisplay $vg 2>&1 | tee cmd.out
+ grep "Inconsistent metadata found for VG $vg" cmd.out
+ vgdisplay $vg 2>&1 | tee cmd.out
+ not grep "Inconsistent metadata found for VG $vg" cmd.out
+ check
+
+ # lvs fixes up
+ init
+ lvs $vg 2>&1 | tee cmd.out
+ grep "Inconsistent metadata found for VG $vg" cmd.out
+ vgdisplay $vg 2>&1 | tee cmd.out
+ not grep "Inconsistent metadata found for VG $vg" cmd.out
+ check
+
+ # vgs fixes up as well
+ init
+ vgs $vg 2>&1 | tee cmd.out
+ grep "Inconsistent metadata found for VG $vg" cmd.out
+ vgs $vg 2>&1 | tee cmd.out
+ not grep "Inconsistent metadata found for VG $vg" cmd.out
+ check
+fi
+
+echo Check auto-repair of failed vgextend - metadata written to original pv but not new pv
+vgremove -f $vg
+pvremove -ff $(cat DEVICES)
+pvcreate $(cat DEVICES)
+aux backup_dev "$dev2"
+vgcreate $vg "$dev1"
+vgextend $vg "$dev2"
+aux restore_dev "$dev2"
+should check compare_fields vgs $vg vg_mda_count pvs "$dev2" vg_mda_count