summaryrefslogtreecommitdiff
path: root/test/shell/thin-many-dmeventd.sh
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2018-09-05 14:36:16 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2018-10-10 09:54:08 +0200
commit5c36ad06a12e25302f6daf7f3504db82845195a8 (patch)
treeb44f71c97ca319e4cd33812ba81a7bf6101d80b3 /test/shell/thin-many-dmeventd.sh
parent194eccf9254653f5085cc116954e7ffb0a759226 (diff)
downloadlvm2-5c36ad06a12e25302f6daf7f3504db82845195a8.tar.gz
tests: check activation of many thin-pool
Artifitical testing of monitoring of many thin-pools with low number of resources in use (need only few pools to actually hit the race).
Diffstat (limited to 'test/shell/thin-many-dmeventd.sh')
-rw-r--r--test/shell/thin-many-dmeventd.sh64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/shell/thin-many-dmeventd.sh b/test/shell/thin-many-dmeventd.sh
new file mode 100644
index 000000000..f73b5161c
--- /dev/null
+++ b/test/shell/thin-many-dmeventd.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 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, MA 02110-1301 USA
+
+# test activation of monitoring with more thin-pool
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+#
+# Main
+#
+aux have_thin 1 0 0 || skip
+
+aux prepare_dmeventd
+aux prepare_vg 2 64
+
+# Create couple pools to later cause race in dmeventd during activation.
+# each pool may add 1sec. extra delay
+
+for i in $(seq 1 5)
+do
+ lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+ # Fill thin-pool to some capacity >50%
+ dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync
+done
+
+lvs -a $vg
+vgchange -an $vg
+
+
+# Try to now activate all existing pool - this will generate in about 10sec later
+# storm of intial call of 'lvextend --use-policies'
+vgchange -ay $vg
+
+# Every 10sec. ATM there is DM status monitoring made by dmeventd
+sleep 9
+
+# Here try to hit the race by creating several new thin-pools in sequence.
+# Creation meets with dmeventd running 'lvextend' command and taking
+# it's internal lvm2 library lock - this used to make impossible to proceed with
+# new thin-pool registration.
+for i in $(seq 11 15)
+do
+ /usr/bin/time -o TM -f %e lvcreate --errorwhenfull y -Zn -T -L4M -V4M $vg/pool_${i} -n $lv${i}
+ read -r t < TM
+ test ${t%%.*} -lt 8 || die "Creation of thin pool took more then 8 second! ($t seconds)"
+ # Fill thin-pool to some capacity >50%
+ dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv${i}" bs=256K count=9 conv=fdatasync
+done
+
+vgremove -f $vg