|
|
e3c68b |
From b7f832288d2d2e57231d90765afc049ad7cb2f9d Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
e3c68b |
Date: Thu, 9 May 2019 14:07:48 +0530
|
|
|
e3c68b |
Subject: [PATCH 165/169] tests/shd: Add test coverage for shd mux
|
|
|
e3c68b |
|
|
|
e3c68b |
This patch add more test cases for shd mux test cases
|
|
|
e3c68b |
The test case includes
|
|
|
e3c68b |
1) Createing multiple volumes to check the attach and detach
|
|
|
e3c68b |
of self heal daemon requests.
|
|
|
e3c68b |
2) Make sure the healing happens in all sceanarios
|
|
|
e3c68b |
3) After a volume detach make sure the threads of the detached
|
|
|
e3c68b |
volume is all cleaned.
|
|
|
e3c68b |
4) Repeat all the above tests for ec volume
|
|
|
e3c68b |
5) Node Reboot case
|
|
|
e3c68b |
6) glusterd restart cases
|
|
|
e3c68b |
7) Add-brick/remove brick
|
|
|
e3c68b |
8) Convert a distributed volume to disperse volume
|
|
|
e3c68b |
9) Convert a replicated volume to distributed volume
|
|
|
e3c68b |
|
|
|
e3c68b |
Backport of: https://review.gluster.org/#/c/glusterfs/+/22697/
|
|
|
e3c68b |
|
|
|
e3c68b |
>Change-Id: I7c317ef9d23a45ffd831157e4890d7c83a8fce7b
|
|
|
e3c68b |
>fixes: bz#1708929
|
|
|
e3c68b |
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
e3c68b |
|
|
|
e3c68b |
Change-Id: Ie732ead9413bd32b8c262303468a0720538334fb
|
|
|
e3c68b |
BUG: 1704562
|
|
|
e3c68b |
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/172634
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
tests/basic/glusterd-restart-shd-mux.t | 96 +++++++++++++++++++++
|
|
|
e3c68b |
tests/basic/shd-mux.t | 149 +++++++++++++++++++++++++++++++++
|
|
|
e3c68b |
tests/basic/volume-scale-shd-mux.t | 112 +++++++++++++++++++++++++
|
|
|
e3c68b |
tests/volume.rc | 15 ++++
|
|
|
e3c68b |
4 files changed, 372 insertions(+)
|
|
|
e3c68b |
create mode 100644 tests/basic/glusterd-restart-shd-mux.t
|
|
|
e3c68b |
create mode 100644 tests/basic/shd-mux.t
|
|
|
e3c68b |
create mode 100644 tests/basic/volume-scale-shd-mux.t
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/tests/basic/glusterd-restart-shd-mux.t b/tests/basic/glusterd-restart-shd-mux.t
|
|
|
e3c68b |
new file mode 100644
|
|
|
e3c68b |
index 0000000..a50af9d
|
|
|
e3c68b |
--- /dev/null
|
|
|
e3c68b |
+++ b/tests/basic/glusterd-restart-shd-mux.t
|
|
|
e3c68b |
@@ -0,0 +1,96 @@
|
|
|
e3c68b |
+#!/bin/bash
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+. $(dirname $0)/../include.rc
|
|
|
e3c68b |
+. $(dirname $0)/../volume.rc
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TESTS_EXPECTED_IN_LOOP=20
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST glusterd
|
|
|
e3c68b |
+TEST pidof glusterd
|
|
|
e3c68b |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2,3,4,5}
|
|
|
e3c68b |
+TEST $CLI volume set $V0 cluster.background-self-heal-count 0
|
|
|
e3c68b |
+TEST $CLI volume set $V0 cluster.eager-lock off
|
|
|
e3c68b |
+TEST $CLI volume set $V0 performance.flush-behind off
|
|
|
e3c68b |
+TEST $CLI volume start $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+for i in $(seq 1 3); do
|
|
|
e3c68b |
+ TEST $CLI volume create ${V0}_afr$i replica 3 $H0:$B0/${V0}_afr${i}{0,1,2,3,4,5}
|
|
|
e3c68b |
+ TEST $CLI volume start ${V0}_afr$i
|
|
|
e3c68b |
+ TEST $CLI volume create ${V0}_ec$i disperse 6 redundancy 2 $H0:$B0/${V0}_ec${i}{0,1,2,3,4,5}
|
|
|
e3c68b |
+ TEST $CLI volume start ${V0}_ec$i
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Stop the glusterd
|
|
|
e3c68b |
+TEST pkill glusterd
|
|
|
e3c68b |
+#Only stopping glusterd, so there will be one shd
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+TEST glusterd
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of ec subvolume (3*6=18)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^18$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of afr subvolume (4*6=24)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^24$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+shd_pid=$(get_shd_mux_pid $V0)
|
|
|
e3c68b |
+for i in $(seq 1 3); do
|
|
|
e3c68b |
+ afr_path="/var/run/gluster/shd/${V0}_afr$i/${V0}_afr$i-shd.pid"
|
|
|
e3c68b |
+ EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" cat $afr_path
|
|
|
e3c68b |
+ ec_path="/var/run/gluster/shd/${V0}_ec$i/${V0}_ec${i}-shd.pid"
|
|
|
e3c68b |
+ EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" cat $ec_path
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Reboot a node scenario
|
|
|
e3c68b |
+TEST pkill gluster
|
|
|
e3c68b |
+#Only stopped glusterd, so there will be one shd
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^0$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST glusterd
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of ec subvolume (3*6=18)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^18$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of afr subvolume (4*6=24)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^24$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+shd_pid=$(get_shd_mux_pid $V0)
|
|
|
e3c68b |
+for i in $(seq 1 3); do
|
|
|
e3c68b |
+ afr_path="/var/run/gluster/shd/${V0}_afr$i/${V0}_afr$i-shd.pid"
|
|
|
e3c68b |
+ EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" cat $afr_path
|
|
|
e3c68b |
+ ec_path="/var/run/gluster/shd/${V0}_ec$i/${V0}_ec${i}-shd.pid"
|
|
|
e3c68b |
+ EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" cat $ec_path
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+for i in $(seq 1 3); do
|
|
|
e3c68b |
+ TEST $CLI volume stop ${V0}_afr$i
|
|
|
e3c68b |
+ TEST $CLI volume stop ${V0}_ec$i
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}0
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}3
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST touch $M0/foo{1..100}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^204$" get_pending_heal_count $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume start ${V0} force
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST rm -rf $M0/*
|
|
|
e3c68b |
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume stop ${V0}
|
|
|
e3c68b |
+TEST $CLI volume delete ${V0}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^0$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup
|
|
|
e3c68b |
diff --git a/tests/basic/shd-mux.t b/tests/basic/shd-mux.t
|
|
|
e3c68b |
new file mode 100644
|
|
|
e3c68b |
index 0000000..e42a34a
|
|
|
e3c68b |
--- /dev/null
|
|
|
e3c68b |
+++ b/tests/basic/shd-mux.t
|
|
|
e3c68b |
@@ -0,0 +1,149 @@
|
|
|
e3c68b |
+#!/bin/bash
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+. $(dirname $0)/../include.rc
|
|
|
e3c68b |
+. $(dirname $0)/../volume.rc
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TESTS_EXPECTED_IN_LOOP=16
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST glusterd
|
|
|
e3c68b |
+TEST pidof glusterd
|
|
|
e3c68b |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2,3,4,5}
|
|
|
e3c68b |
+TEST $CLI volume set $V0 cluster.background-self-heal-count 0
|
|
|
e3c68b |
+TEST $CLI volume set $V0 cluster.eager-lock off
|
|
|
e3c68b |
+TEST $CLI volume set $V0 performance.flush-behind off
|
|
|
e3c68b |
+TEST $CLI volume start $V0
|
|
|
e3c68b |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+shd_pid=$(get_shd_mux_pid $V0)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Create a one more volume
|
|
|
e3c68b |
+TEST $CLI volume create ${V0}_1 replica 3 $H0:$B0/${V0}_1{0,1,2,3,4,5}
|
|
|
e3c68b |
+TEST $CLI volume start ${V0}_1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check whether the shd has multiplexed or not
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" get_shd_mux_pid ${V0}_1
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" get_shd_mux_pid ${V0}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume set ${V0}_1 cluster.background-self-heal-count 0
|
|
|
e3c68b |
+TEST $CLI volume set ${V0}_1 cluster.eager-lock off
|
|
|
e3c68b |
+TEST $CLI volume set ${V0}_1 performance.flush-behind off
|
|
|
e3c68b |
+TEST $GFS --volfile-id=/${V0}_1 --volfile-server=$H0 $M1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}0
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}4
|
|
|
e3c68b |
+TEST kill_brick ${V0}_1 $H0 $B0/${V0}_10
|
|
|
e3c68b |
+TEST kill_brick ${V0}_1 $H0 $B0/${V0}_14
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST touch $M0/foo{1..100}
|
|
|
e3c68b |
+TEST touch $M1/foo{1..100}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^204$" get_pending_heal_count $V0
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^204$" get_pending_heal_count ${V0}_1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume start ${V0} force
|
|
|
e3c68b |
+TEST $CLI volume start ${V0}_1 force
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count ${V0}_1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST rm -rf $M0/*
|
|
|
e3c68b |
+TEST rm -rf $M1/*
|
|
|
e3c68b |
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Stop the volume
|
|
|
e3c68b |
+TEST $CLI volume stop ${V0}_1
|
|
|
e3c68b |
+TEST $CLI volume delete ${V0}_1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check the stop succeeded and detached the volume with out restarting it
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" get_shd_mux_pid $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check the thread count become to earlier number after stopping
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Now create a ec volume and check mux works
|
|
|
e3c68b |
+TEST $CLI volume create ${V0}_2 disperse 6 redundancy 2 $H0:$B0/${V0}_2{0,1,2,3,4,5}
|
|
|
e3c68b |
+TEST $CLI volume start ${V0}_2
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check whether the shd has multiplexed or not
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" get_shd_mux_pid ${V0}_2
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" get_shd_mux_pid ${V0}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume set ${V0}_2 cluster.background-self-heal-count 0
|
|
|
e3c68b |
+TEST $CLI volume set ${V0}_2 cluster.eager-lock off
|
|
|
e3c68b |
+TEST $CLI volume set ${V0}_2 performance.flush-behind off
|
|
|
e3c68b |
+TEST $GFS --volfile-id=/${V0}_2 --volfile-server=$H0 $M1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}0
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}4
|
|
|
e3c68b |
+TEST kill_brick ${V0}_2 $H0 $B0/${V0}_20
|
|
|
e3c68b |
+TEST kill_brick ${V0}_2 $H0 $B0/${V0}_22
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST touch $M0/foo{1..100}
|
|
|
e3c68b |
+TEST touch $M1/foo{1..100}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^204$" get_pending_heal_count $V0
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^404$" get_pending_heal_count ${V0}_2
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume start ${V0} force
|
|
|
e3c68b |
+TEST $CLI volume start ${V0}_2 force
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^6$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count ${V0}_2
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST rm -rf $M0/*
|
|
|
e3c68b |
+TEST rm -rf $M1/*
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Stop the volume
|
|
|
e3c68b |
+TEST $CLI volume stop ${V0}_2
|
|
|
e3c68b |
+TEST $CLI volume delete ${V0}_2
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check the stop succeeded and detached the volume with out restarting it
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" get_shd_mux_pid $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check the thread count become to zero for ec related threads
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^0$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+#Check the thread count become to earlier number after stopping
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+for i in $(seq 1 3); do
|
|
|
e3c68b |
+ TEST $CLI volume create ${V0}_afr$i replica 3 $H0:$B0/${V0}_afr${i}{0,1,2,3,4,5}
|
|
|
e3c68b |
+ TEST $CLI volume start ${V0}_afr$i
|
|
|
e3c68b |
+ TEST $CLI volume create ${V0}_ec$i disperse 6 redundancy 2 $H0:$B0/${V0}_ec${i}{0,1,2,3,4,5}
|
|
|
e3c68b |
+ TEST $CLI volume start ${V0}_ec$i
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of ec subvolume (3*6=18)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^18$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of afr subvolume (4*6=24)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^24$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+#Delete the volumes
|
|
|
e3c68b |
+for i in $(seq 1 3); do
|
|
|
e3c68b |
+ TEST $CLI volume stop ${V0}_afr$i
|
|
|
e3c68b |
+ TEST $CLI volume stop ${V0}_ec$i
|
|
|
e3c68b |
+ TEST $CLI volume delete ${V0}_afr$i
|
|
|
e3c68b |
+ TEST $CLI volume delete ${V0}_ec$i
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^${shd_pid}$" get_shd_mux_pid $V0
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume stop ${V0}
|
|
|
e3c68b |
+TEST $CLI volume delete ${V0}
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^0$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup
|
|
|
e3c68b |
diff --git a/tests/basic/volume-scale-shd-mux.t b/tests/basic/volume-scale-shd-mux.t
|
|
|
e3c68b |
new file mode 100644
|
|
|
e3c68b |
index 0000000..dd9cf83
|
|
|
e3c68b |
--- /dev/null
|
|
|
e3c68b |
+++ b/tests/basic/volume-scale-shd-mux.t
|
|
|
e3c68b |
@@ -0,0 +1,112 @@
|
|
|
e3c68b |
+#!/bin/bash
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+. $(dirname $0)/../include.rc
|
|
|
e3c68b |
+. $(dirname $0)/../volume.rc
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TESTS_EXPECTED_IN_LOOP=6
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST glusterd
|
|
|
e3c68b |
+TEST pidof glusterd
|
|
|
e3c68b |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2,3,4,5}
|
|
|
e3c68b |
+TEST $CLI volume set $V0 cluster.background-self-heal-count 0
|
|
|
e3c68b |
+TEST $CLI volume set $V0 cluster.eager-lock off
|
|
|
e3c68b |
+TEST $CLI volume set $V0 performance.flush-behind off
|
|
|
e3c68b |
+TEST $CLI volume start $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+for i in $(seq 1 2); do
|
|
|
e3c68b |
+ TEST $CLI volume create ${V0}_afr$i replica 3 $H0:$B0/${V0}_afr${i}{0,1,2,3,4,5}
|
|
|
e3c68b |
+ TEST $CLI volume start ${V0}_afr$i
|
|
|
e3c68b |
+ TEST $CLI volume create ${V0}_ec$i disperse 6 redundancy 2 $H0:$B0/${V0}_ec${i}{0,1,2,3,4,5}
|
|
|
e3c68b |
+ TEST $CLI volume start ${V0}_ec$i
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of ec subvolume (2*6=12)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^12$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of afr subvolume (3*6=18)
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^18$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume add-brick $V0 replica 3 $H0:$B0/${V0}{6,7,8};
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of afr subvolume plus 3 additional threads from newly added bricks (3*6+3=21)
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^21$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Remove the brick and check the detach is successful
|
|
|
e3c68b |
+$CLI volume remove-brick $V0 $H0:$B0/${V0}{6,7,8} force
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^18$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume add-brick ${V0}_ec1 $H0:$B0/${V0}_ec1_add{0,1,2,3,4,5};
|
|
|
e3c68b |
+#Check the thread count become to number of volumes*number of ec subvolume plus 2 additional threads from newly added bricks (2*6+6=18)
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^18$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Remove the brick and check the detach is successful
|
|
|
e3c68b |
+$CLI volume remove-brick ${V0}_ec1 $H0:$B0/${V0}_ec1_add{0,1,2,3,4,5} force
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^12$" number_healer_threads_shd $V0 "__ec_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+for i in $(seq 1 2); do
|
|
|
e3c68b |
+ TEST $CLI volume stop ${V0}_afr$i
|
|
|
e3c68b |
+ TEST $CLI volume stop ${V0}_ec$i
|
|
|
e3c68b |
+done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}0
|
|
|
e3c68b |
+TEST kill_brick $V0 $H0 $B0/${V0}4
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST touch $M0/foo{1..100}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^204$" get_pending_heal_count $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume start ${V0} force
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST rm -rf $M0/*
|
|
|
e3c68b |
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
|
|
|
e3c68b |
+shd_pid=$(get_shd_mux_pid $V0)
|
|
|
e3c68b |
+TEST $CLI volume create ${V0}_distribute1 $H0:$B0/${V0}_distribute10
|
|
|
e3c68b |
+TEST $CLI volume start ${V0}_distribute1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Creating a non-replicate/non-ec volume should not have any effect in shd
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+EXPECT "^${shd_pid}$" get_shd_mux_pid $V0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST mkdir $B0/add/
|
|
|
e3c68b |
+#Now convert the distributed volume to replicate
|
|
|
e3c68b |
+TEST $CLI volume add-brick ${V0}_distribute1 replica 3 $H0:$B0/add/{2..3}
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^9$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#scale down the volume
|
|
|
e3c68b |
+TEST $CLI volume remove-brick ${V0}_distribute1 replica 1 $H0:$B0/add/{2..3} force
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^6$" number_healer_threads_shd $V0 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI volume stop ${V0}
|
|
|
e3c68b |
+TEST $CLI volume delete ${V0}
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^0$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST rm -rf $B0/add/
|
|
|
e3c68b |
+TEST mkdir $B0/add/
|
|
|
e3c68b |
+#Now convert the distributed volume back to replicate and make sure that a new shd is spawned
|
|
|
e3c68b |
+TEST $CLI volume add-brick ${V0}_distribute1 replica 3 $H0:$B0/add/{2..3};
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^1$" shd_count
|
|
|
e3c68b |
+EXPECT_WITHIN $HEAL_TIMEOUT "^3$" number_healer_threads_shd ${V0}_distribute1 "__afr_shd_healer_wait"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Now convert the replica volume to distribute again and make sure the shd is now stopped
|
|
|
e3c68b |
+TEST $CLI volume remove-brick ${V0}_distribute1 replica 1 $H0:$B0/add/{2..3} force
|
|
|
e3c68b |
+TEST rm -rf $B0/add/
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "^0$" shd_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup
|
|
|
e3c68b |
diff --git a/tests/volume.rc b/tests/volume.rc
|
|
|
e3c68b |
index a0ea3b8..bb400cc 100644
|
|
|
e3c68b |
--- a/tests/volume.rc
|
|
|
e3c68b |
+++ b/tests/volume.rc
|
|
|
e3c68b |
@@ -912,3 +912,18 @@ function volgen_check_ancestry {
|
|
|
e3c68b |
echo "N"
|
|
|
e3c68b |
fi
|
|
|
e3c68b |
}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+function get_shd_mux_pid {
|
|
|
e3c68b |
+ local volume=$1
|
|
|
e3c68b |
+ pid=`$CLI volume status $volume shd | awk '/Self-heal/{print $8}'`
|
|
|
e3c68b |
+ echo $pid
|
|
|
e3c68b |
+}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+function shd_count {
|
|
|
e3c68b |
+ ps aux | grep "glustershd" | grep -v grep | wc -l
|
|
|
e3c68b |
+}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+function number_healer_threads_shd {
|
|
|
e3c68b |
+ local pid=$(get_shd_mux_pid $1)
|
|
|
e3c68b |
+ pstack $pid | grep $2 | wc -l
|
|
|
e3c68b |
+}
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|