summaryrefslogtreecommitdiff
path: root/test/shell/lvchange-raid1-writemostly.sh
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2017-02-23 15:09:29 +0100
committerHeinz Mauelshagen <heinzm@redhat.com>2017-02-23 15:09:29 +0100
commit8ab072507706fb826eee05eb369429ad0a7a406a (patch)
treec0c98ed9faa0105985b4284a8481470758d2cedd /test/shell/lvchange-raid1-writemostly.sh
parent3f4ecaf8c2b3146e81bcb32bd4f0321beee1192a (diff)
downloadlvm2-8ab072507706fb826eee05eb369429ad0a7a406a.tar.gz
lvchange: reject writemostly/writebehind on raid1 during resyncsourceware_master
The MD kernel raid1 personality does no use any writemostly leg as the primary. In case a previous linear LV holding data gets upconverted to raid1 it becomes the primary leg of the new raid1 LV and a full resynchronization is started to update the new legs. No writemostly and/or writebehind setting may be allowed during this initial, full synchronization period of this new raid1 LV (using the lvchange(8) command), because that would change the primary (i.e the previous linear LV) thus causing data loss. lvchange has a bug not preventing this scenario. Fix rejects setting writemostly and/or writebehind on resychronizing raid1 LVs. Once we have status in the lvm2 metadata about the linear -> raid upconversion, we may relax this constraint for other types of resynchronization (e.g. for user requested "lvchange --resync "). New lvchange-raid1-writemostly.sh test is added to the test suite. Resolves: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855895
Diffstat (limited to 'test/shell/lvchange-raid1-writemostly.sh')
-rw-r--r--test/shell/lvchange-raid1-writemostly.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/shell/lvchange-raid1-writemostly.sh b/test/shell/lvchange-raid1-writemostly.sh
new file mode 100644
index 000000000..edf11bd4e
--- /dev/null
+++ b/test/shell/lvchange-raid1-writemostly.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which mkfs.ext4 || skip
+aux have_raid 1 3 5 || skip
+
+aux prepare_vg 4
+
+for d in $dev1 $dev2 $dev3 $dev4
+do
+ aux delay_dev $d 1
+done
+
+#
+# Test writemostly prohibited on resyncrhonizing raid1
+#
+
+# Create 4-way striped LV
+lvcreate -aey --ty raid1 -m 3 -L 32M -n $lv1 $vg
+not lvchange -y --writemostly $dev1 $vg/$lv1
+check lv_field $vg/$lv1 segtype "raid1"
+check lv_field $vg/$lv1 stripes 4
+check lv_attr_bit health $vg/${lv1}_rimage_0 "-"
+aux wait_for_sync $vg $lv1
+lvchange -y --writemostly $dev1 $vg/$lv1
+check lv_attr_bit health $vg/${lv1}_rimage_0 "w"
+
+vgremove -ff $vg