summaryrefslogtreecommitdiffstats
path: root/qa/workunits/rbd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:13 +0000
commit389020e14594e4894e28d1eb9103c210b142509e (patch)
tree2ba734cdd7a243f46dda7c3d0cc88c2293d9699f /qa/workunits/rbd
parentAdding upstream version 18.2.2. (diff)
downloadceph-389020e14594e4894e28d1eb9103c210b142509e.tar.xz
ceph-389020e14594e4894e28d1eb9103c210b142509e.zip
Adding upstream version 18.2.3.upstream/18.2.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qa/workunits/rbd')
-rwxr-xr-xqa/workunits/rbd/cli_generic.sh9
-rwxr-xr-xqa/workunits/rbd/compare_mirror_image_alternate_primary.sh106
-rwxr-xr-xqa/workunits/rbd/compare_mirror_images.sh170
-rwxr-xr-xqa/workunits/rbd/rbd-nbd.sh5
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_bootstrap.sh4
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_fsx_compare.sh4
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_fsx_prepare.sh4
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_ha.sh4
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_helpers.sh33
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_journal.sh4
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_snapshot.sh4
-rwxr-xr-xqa/workunits/rbd/rbd_mirror_stress.sh4
12 files changed, 322 insertions, 29 deletions
diff --git a/qa/workunits/rbd/cli_generic.sh b/qa/workunits/rbd/cli_generic.sh
index 57279d26d..15c47074d 100755
--- a/qa/workunits/rbd/cli_generic.sh
+++ b/qa/workunits/rbd/cli_generic.sh
@@ -432,6 +432,7 @@ test_trash() {
rbd trash mv test2
ID=`rbd trash ls | cut -d ' ' -f 1`
rbd info --image-id $ID | grep "rbd image 'test2'"
+ rbd children --image-id $ID | wc -l | grep 0
rbd trash restore $ID
rbd ls | grep test2
@@ -449,6 +450,7 @@ test_trash() {
rbd create $RBD_CREATE_ARGS -s 1 test1
rbd snap create test1@snap1
rbd snap protect test1@snap1
+ rbd clone test1@snap1 clone
rbd trash mv test1
rbd trash ls | grep test1
@@ -459,7 +461,10 @@ test_trash() {
ID=`rbd trash ls | cut -d ' ' -f 1`
rbd snap ls --image-id $ID | grep -v 'SNAPID' | wc -l | grep 1
rbd snap ls --image-id $ID | grep '.*snap1.*'
+ rbd children --image-id $ID | wc -l | grep 1
+ rbd children --image-id $ID | grep 'clone'
+ rbd rm clone
rbd snap unprotect --image-id $ID --snap snap1
rbd snap rm --image-id $ID --snap snap1
rbd snap ls --image-id $ID | grep -v 'SNAPID' | wc -l | grep 0
@@ -1261,7 +1266,6 @@ test_trash_purge_schedule_recovery() {
jq 'select(.name == "rbd_support")' |
jq -r '[.addrvec[0].addr, "/", .addrvec[0].nonce|tostring] | add')
ceph osd blocklist add $CLIENT_ADDR
- ceph osd blocklist ls | grep $CLIENT_ADDR
# Check that you can add a trash purge schedule after a few retries
expect_fail rbd trash purge schedule add -p rbd3 10m
@@ -1420,7 +1424,6 @@ test_mirror_snapshot_schedule_recovery() {
jq 'select(.name == "rbd_support")' |
jq -r '[.addrvec[0].addr, "/", .addrvec[0].nonce|tostring] | add')
ceph osd blocklist add $CLIENT_ADDR
- ceph osd blocklist ls | grep $CLIENT_ADDR
# Check that you can add a mirror snapshot schedule after a few retries
expect_fail rbd mirror snapshot schedule add -p rbd3/ns1 --image test1 2m
@@ -1529,7 +1532,6 @@ test_perf_image_iostat_recovery() {
jq 'select(.name == "rbd_support")' |
jq -r '[.addrvec[0].addr, "/", .addrvec[0].nonce|tostring] | add')
ceph osd blocklist add $CLIENT_ADDR
- ceph osd blocklist ls | grep $CLIENT_ADDR
expect_fail rbd perf image iostat --format json rbd3/ns
sleep 10
@@ -1661,7 +1663,6 @@ test_tasks_recovery() {
jq 'select(.name == "rbd_support")' |
jq -r '[.addrvec[0].addr, "/", .addrvec[0].nonce|tostring] | add')
ceph osd blocklist add $CLIENT_ADDR
- ceph osd blocklist ls | grep $CLIENT_ADDR
expect_fail ceph rbd task add flatten rbd2/clone1
sleep 10
diff --git a/qa/workunits/rbd/compare_mirror_image_alternate_primary.sh b/qa/workunits/rbd/compare_mirror_image_alternate_primary.sh
new file mode 100755
index 000000000..78a390230
--- /dev/null
+++ b/qa/workunits/rbd/compare_mirror_image_alternate_primary.sh
@@ -0,0 +1,106 @@
+#!/usr/bin/env bash
+
+set -ex
+
+IMAGE=image-alternate-primary
+MIRROR_IMAGE_MODE=snapshot
+MIRROR_POOL_MODE=image
+MOUNT=test-alternate-primary
+RBD_IMAGE_FEATURES='layering,exclusive-lock,object-map,fast-diff'
+RBD_MIRROR_INSTANCES=1
+RBD_MIRROR_MODE=snapshot
+RBD_MIRROR_USE_EXISTING_CLUSTER=1
+
+. $(dirname $0)/rbd_mirror_helpers.sh
+
+take_mirror_snapshots() {
+ local cluster=$1
+ local pool=$2
+ local image=$3
+
+ for i in {1..30}; do
+ mirror_image_snapshot $cluster $pool $image
+ sleep 3
+ done
+}
+
+slow_untar_workload() {
+ local mountpt=$1
+
+ cp linux-5.4.tar.gz $mountpt
+ # run workload that updates the data and metadata of multiple files on disk.
+ # rate limit the workload such that the mirror snapshots can be taken as the
+ # contents of the image are progressively changed by the workload.
+ local ret=0
+ timeout 5m bash -c "zcat $mountpt/linux-5.4.tar.gz \
+ | pv -L 256K | tar xf - -C $mountpt" || ret=$?
+ if ((ret != 124)); then
+ echo "Workload completed prematurely"
+ return 1
+ fi
+}
+
+setup
+
+start_mirrors ${CLUSTER1}
+start_mirrors ${CLUSTER2}
+
+# initial setup
+create_image_and_enable_mirror ${CLUSTER1} ${POOL} ${IMAGE} \
+ ${RBD_MIRROR_MODE} 10G
+
+if [[ $RBD_DEVICE_TYPE == "nbd" ]]; then
+ DEV=$(sudo rbd --cluster ${CLUSTER1} device map -t nbd \
+ -o try-netlink ${POOL}/${IMAGE})
+elif [[ $RBD_DEVICE_TYPE == "krbd" ]]; then
+ DEV=$(sudo rbd --cluster ${CLUSTER1} device map -t krbd \
+ ${POOL}/${IMAGE})
+else
+ echo "Unknown RBD_DEVICE_TYPE: ${RBD_DEVICE_TYPE}"
+ exit 1
+fi
+sudo mkfs.ext4 ${DEV}
+mkdir ${MOUNT}
+
+wget https://download.ceph.com/qa/linux-5.4.tar.gz
+
+for i in {1..25}; do
+ # create mirror snapshots every few seconds under I/O
+ sudo mount ${DEV} ${MOUNT}
+ sudo chown $(whoami) ${MOUNT}
+ rm -rf ${MOUNT}/*
+ take_mirror_snapshots ${CLUSTER1} ${POOL} ${IMAGE} &
+ SNAP_PID=$!
+ slow_untar_workload ${MOUNT}
+ wait $SNAP_PID
+ sudo umount ${MOUNT}
+
+ # calculate hash before demotion of primary image
+ DEMOTE_MD5=$(sudo md5sum ${DEV} | awk '{print $1}')
+ sudo rbd --cluster ${CLUSTER1} device unmap -t ${RBD_DEVICE_TYPE} ${DEV}
+
+ demote_image ${CLUSTER1} ${POOL} ${IMAGE}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${IMAGE} 'up+unknown'
+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${IMAGE} 'up+unknown'
+ promote_image ${CLUSTER2} ${POOL} ${IMAGE}
+
+ # calculate hash after promotion of secondary image
+ if [[ $RBD_DEVICE_TYPE == "nbd" ]]; then
+ DEV=$(sudo rbd --cluster ${CLUSTER2} device map -t nbd \
+ -o try-netlink ${POOL}/${IMAGE})
+ elif [[ $RBD_DEVICE_TYPE == "krbd" ]]; then
+ DEV=$(sudo rbd --cluster ${CLUSTER2} device map -t krbd ${POOL}/${IMAGE})
+ fi
+ PROMOTE_MD5=$(sudo md5sum ${DEV} | awk '{print $1}')
+
+ if [[ "${DEMOTE_MD5}" != "${PROMOTE_MD5}" ]]; then
+ echo "Mismatch at iteration ${i}: ${DEMOTE_MD5} != ${PROMOTE_MD5}"
+ exit 1
+ fi
+
+ TEMP=${CLUSTER1}
+ CLUSTER1=${CLUSTER2}
+ CLUSTER2=${TEMP}
+done
+
+echo OK
diff --git a/qa/workunits/rbd/compare_mirror_images.sh b/qa/workunits/rbd/compare_mirror_images.sh
new file mode 100755
index 000000000..cbaa77a71
--- /dev/null
+++ b/qa/workunits/rbd/compare_mirror_images.sh
@@ -0,0 +1,170 @@
+#!/usr/bin/env bash
+
+set -ex
+
+IMG_PREFIX=image-primary
+MIRROR_IMAGE_MODE=snapshot
+MIRROR_POOL_MODE=image
+MNTPT_PREFIX=test-primary
+RBD_IMAGE_FEATURES='layering,exclusive-lock,object-map,fast-diff'
+RBD_MIRROR_INSTANCES=1
+RBD_MIRROR_MODE=snapshot
+RBD_MIRROR_USE_EXISTING_CLUSTER=1
+
+. $(dirname $0)/rbd_mirror_helpers.sh
+
+take_mirror_snapshots() {
+ local cluster=$1
+ local pool=$2
+ local image=$3
+
+ for i in {1..30}; do
+ mirror_image_snapshot $cluster $pool $image
+ sleep 3
+ done
+}
+
+slow_untar_workload() {
+ local mountpt=$1
+
+ cp linux-5.4.tar.gz $mountpt
+ # run workload that updates the data and metadata of multiple files on disk.
+ # rate limit the workload such that the mirror snapshots can be taken as the
+ # contents of the image are progressively changed by the workload.
+ local ret=0
+ timeout 5m bash -c "zcat $mountpt/linux-5.4.tar.gz \
+ | pv -L 256K | tar xf - -C $mountpt" || ret=$?
+ if ((ret != 124)); then
+ echo "Workload completed prematurely"
+ return 1
+ fi
+}
+
+wait_for_image_removal() {
+ local cluster=$1
+ local pool=$2
+ local image=$3
+
+ for s in 1 2 4 8 8 8 8 8 8 8 8 16 16; do
+ if ! rbd --cluster $cluster ls $pool | grep -wq $image; then
+ return 0
+ fi
+ sleep $s
+ done
+
+ echo "image ${pool}/${image} not removed from cluster ${cluster}"
+ return 1
+}
+
+compare_demoted_promoted_image() {
+ local dev=${DEVS[$1-1]}
+ local img=${IMG_PREFIX}$1
+ local mntpt=${MNTPT_PREFIX}$1
+ local demote_md5 promote_md5
+
+ sudo umount ${mntpt}
+
+ # calculate hash before demotion of primary image
+ demote_md5=$(sudo md5sum ${dev} | awk '{print $1}')
+ sudo rbd --cluster ${CLUSTER1} device unmap -t ${RBD_DEVICE_TYPE} \
+ ${POOL}/${img}
+
+ demote_image ${CLUSTER1} ${POOL} ${img}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${img} 'up+unknown'
+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${img} 'up+unknown'
+ promote_image ${CLUSTER2} ${POOL} ${img}
+
+ # calculate hash after promotion of secondary image
+ if [[ $RBD_DEVICE_TYPE == "nbd" ]]; then
+ dev=$(sudo rbd --cluster ${CLUSTER2} device map -t nbd \
+ -o try-netlink ${POOL}/${img})
+ elif [[ $RBD_DEVICE_TYPE == "krbd" ]]; then
+ dev=$(sudo rbd --cluster ${CLUSTER2} device map -t krbd ${POOL}/${img})
+ fi
+ promote_md5=$(sudo md5sum ${dev} | awk '{print $1}')
+ sudo rbd --cluster ${CLUSTER2} device unmap -t ${RBD_DEVICE_TYPE} ${dev}
+
+ if [[ "${demote_md5}" != "${promote_md5}" ]]; then
+ echo "Mismatch for image ${POOL}/${img}: ${demote_md5} != ${promote_md5}"
+ return 1
+ fi
+}
+
+setup
+
+start_mirrors ${CLUSTER1}
+start_mirrors ${CLUSTER2}
+
+wget https://download.ceph.com/qa/linux-5.4.tar.gz
+
+for i in {1..10}; do
+ DEVS=()
+ SNAP_PIDS=()
+ COMPARE_PIDS=()
+ WORKLOAD_PIDS=()
+ RET=0
+ for j in {1..10}; do
+ IMG=${IMG_PREFIX}${j}
+ MNTPT=${MNTPT_PREFIX}${j}
+ create_image_and_enable_mirror ${CLUSTER1} ${POOL} ${IMG} \
+ ${RBD_MIRROR_MODE} 10G
+ if [[ $RBD_DEVICE_TYPE == "nbd" ]]; then
+ DEV=$(sudo rbd --cluster ${CLUSTER1} device map -t nbd \
+ -o try-netlink ${POOL}/${IMG})
+ elif [[ $RBD_DEVICE_TYPE == "krbd" ]]; then
+ DEV=$(sudo rbd --cluster ${CLUSTER1} device map -t krbd \
+ ${POOL}/${IMG})
+ else
+ echo "Unknown RBD_DEVICE_TYPE: ${RBD_DEVICE_TYPE}"
+ exit 1
+ fi
+ DEVS+=($DEV)
+ sudo mkfs.ext4 ${DEV}
+ mkdir ${MNTPT}
+ sudo mount ${DEV} ${MNTPT}
+ sudo chown $(whoami) ${MNTPT}
+ # create mirror snapshots under I/O every few seconds
+ take_mirror_snapshots ${CLUSTER1} ${POOL} ${IMG} &
+ SNAP_PIDS+=($!)
+ slow_untar_workload ${MNTPT} &
+ WORKLOAD_PIDS+=($!)
+ done
+ for pid in ${SNAP_PIDS[@]}; do
+ wait $pid || RET=$?
+ done
+ if ((RET != 0)); then
+ echo "take_mirror_snapshots failed"
+ exit 1
+ fi
+ for pid in ${WORKLOAD_PIDS[@]}; do
+ wait $pid || RET=$?
+ done
+ if ((RET != 0)); then
+ echo "slow_untar_workload failed"
+ exit 1
+ fi
+
+ for j in {1..10}; do
+ compare_demoted_promoted_image $j &
+ COMPARE_PIDS+=($!)
+ done
+ for pid in ${COMPARE_PIDS[@]}; do
+ wait $pid || RET=$?
+ done
+ if ((RET != 0)); then
+ echo "compare_demoted_promoted_image failed"
+ exit 1
+ fi
+
+ for j in {1..10}; do
+ IMG=${IMG_PREFIX}${j}
+ # Allow for removal of non-primary image by checking that mirroring
+ # image status is "up+replaying"
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${IMG} 'up+replaying'
+ remove_image ${CLUSTER2} ${POOL} ${IMG}
+ wait_for_image_removal ${CLUSTER1} ${POOL} ${IMG}
+ rm -rf ${MNTPT_PREFIX}${j}
+ done
+done
+
+echo OK
diff --git a/qa/workunits/rbd/rbd-nbd.sh b/qa/workunits/rbd/rbd-nbd.sh
index bc89e9be5..8e1b05b3f 100755
--- a/qa/workunits/rbd/rbd-nbd.sh
+++ b/qa/workunits/rbd/rbd-nbd.sh
@@ -202,8 +202,11 @@ provisioned=`rbd -p ${POOL} --format xml du ${IMAGE} |
used=`rbd -p ${POOL} --format xml du ${IMAGE} |
$XMLSTARLET sel -t -m "//stats/images/image/used_size" -v .`
[ "${used}" -lt "${provisioned}" ]
+unmap_device ${DEV} ${PID}
# resize test
+DEV=`_sudo rbd device -t nbd -o try-netlink map ${POOL}/${IMAGE}`
+get_pid ${POOL}
devname=$(basename ${DEV})
blocks=$(awk -v dev=${devname} '$4 == dev {print $3}' /proc/partitions)
test -n "${blocks}"
@@ -216,9 +219,9 @@ rbd resize ${POOL}/${IMAGE} --allow-shrink --size ${SIZE}M
blocks2=$(awk -v dev=${devname} '$4 == dev {print $3}' /proc/partitions)
test -n "${blocks2}"
test ${blocks2} -eq ${blocks}
+unmap_device ${DEV} ${PID}
# read-only option test
-unmap_device ${DEV} ${PID}
DEV=`_sudo rbd --device-type nbd map --read-only ${POOL}/${IMAGE}`
PID=$(rbd device --device-type nbd list | awk -v pool=${POOL} -v img=${IMAGE} -v dev=${DEV} \
'$2 == pool && $3 == img && $5 == dev {print $1}')
diff --git a/qa/workunits/rbd/rbd_mirror_bootstrap.sh b/qa/workunits/rbd/rbd_mirror_bootstrap.sh
index 6ef06f2b8..f4c1070bc 100755
--- a/qa/workunits/rbd/rbd_mirror_bootstrap.sh
+++ b/qa/workunits/rbd/rbd_mirror_bootstrap.sh
@@ -1,8 +1,10 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
#
# rbd_mirror_bootstrap.sh - test peer bootstrap create/import
#
+set -ex
+
RBD_MIRROR_MANUAL_PEERS=1
RBD_MIRROR_INSTANCES=${RBD_MIRROR_INSTANCES:-1}
. $(dirname $0)/rbd_mirror_helpers.sh
diff --git a/qa/workunits/rbd/rbd_mirror_fsx_compare.sh b/qa/workunits/rbd/rbd_mirror_fsx_compare.sh
index 0ba3c97d7..79c36546d 100755
--- a/qa/workunits/rbd/rbd_mirror_fsx_compare.sh
+++ b/qa/workunits/rbd/rbd_mirror_fsx_compare.sh
@@ -1,10 +1,12 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
#
# rbd_mirror_fsx_compare.sh - test rbd-mirror daemon under FSX workload
#
# The script is used to compare FSX-generated images between two clusters.
#
+set -ex
+
. $(dirname $0)/rbd_mirror_helpers.sh
trap 'cleanup $?' INT TERM EXIT
diff --git a/qa/workunits/rbd/rbd_mirror_fsx_prepare.sh b/qa/workunits/rbd/rbd_mirror_fsx_prepare.sh
index d988987ba..6daadbbb4 100755
--- a/qa/workunits/rbd/rbd_mirror_fsx_prepare.sh
+++ b/qa/workunits/rbd/rbd_mirror_fsx_prepare.sh
@@ -1,10 +1,12 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
#
# rbd_mirror_fsx_prepare.sh - test rbd-mirror daemon under FSX workload
#
# The script is used to compare FSX-generated images between two clusters.
#
+set -ex
+
. $(dirname $0)/rbd_mirror_helpers.sh
setup
diff --git a/qa/workunits/rbd/rbd_mirror_ha.sh b/qa/workunits/rbd/rbd_mirror_ha.sh
index 37739a83d..1e43712a6 100755
--- a/qa/workunits/rbd/rbd_mirror_ha.sh
+++ b/qa/workunits/rbd/rbd_mirror_ha.sh
@@ -1,8 +1,10 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
#
# rbd_mirror_ha.sh - test rbd-mirror daemons in HA mode
#
+set -ex
+
RBD_MIRROR_INSTANCES=${RBD_MIRROR_INSTANCES:-7}
. $(dirname $0)/rbd_mirror_helpers.sh
diff --git a/qa/workunits/rbd/rbd_mirror_helpers.sh b/qa/workunits/rbd/rbd_mirror_helpers.sh
index f4961b925..b6abff96d 100755
--- a/qa/workunits/rbd/rbd_mirror_helpers.sh
+++ b/qa/workunits/rbd/rbd_mirror_helpers.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
#
# rbd_mirror_helpers.sh - shared rbd-mirror daemon helper functions
#
@@ -814,23 +814,23 @@ test_status_in_pool_dir()
local description_pattern="$5"
local service_pattern="$6"
- local status_log=${TEMPDIR}/$(mkfname ${cluster}-${pool}-${image}.mirror_status)
- CEPH_ARGS='' rbd --cluster ${cluster} mirror image status ${pool}/${image} |
- tee ${status_log} >&2
- grep "^ state: .*${state_pattern}" ${status_log} || return 1
- grep "^ description: .*${description_pattern}" ${status_log} || return 1
+ local status
+ status=$(CEPH_ARGS='' rbd --cluster ${cluster} mirror image status \
+ ${pool}/${image})
+ grep "^ state: .*${state_pattern}" <<< "$status" || return 1
+ grep "^ description: .*${description_pattern}" <<< "$status" || return 1
if [ -n "${service_pattern}" ]; then
- grep "service: *${service_pattern}" ${status_log} || return 1
+ grep "service: *${service_pattern}" <<< "$status" || return 1
elif echo ${state_pattern} | grep '^up+'; then
- grep "service: *${MIRROR_USER_ID_PREFIX}.* on " ${status_log} || return 1
+ grep "service: *${MIRROR_USER_ID_PREFIX}.* on " <<< "$status" || return 1
else
- grep "service: " ${status_log} && return 1
+ grep "service: " <<< "$status" && return 1
fi
# recheck using `mirror pool status` command to stress test it.
-
- local last_update="$(sed -nEe 's/^ last_update: *(.*) *$/\1/p' ${status_log})"
+ local last_update
+ last_update="$(sed -nEe 's/^ last_update: *(.*) *$/\1/p' <<< "$status")"
test_mirror_pool_status_verbose \
${cluster} ${pool} ${image} "${state_pattern}" "${last_update}" &&
return 0
@@ -847,16 +847,15 @@ test_mirror_pool_status_verbose()
local state_pattern="$4"
local prev_last_update="$5"
- local status_log=${TEMPDIR}/$(mkfname ${cluster}-${pool}.mirror_status)
-
- rbd --cluster ${cluster} mirror pool status ${pool} --verbose --format xml \
- > ${status_log}
+ local status
+ status=$(CEPH_ARGS='' rbd --cluster ${cluster} mirror pool status ${pool} \
+ --verbose --format xml)
local last_update state
last_update=$($XMLSTARLET sel -t -v \
- "//images/image[name='${image}']/last_update" < ${status_log})
+ "//images/image[name='${image}']/last_update" <<< "$status")
state=$($XMLSTARLET sel -t -v \
- "//images/image[name='${image}']/state" < ${status_log})
+ "//images/image[name='${image}']/state" <<< "$status")
echo "${state}" | grep "${state_pattern}" ||
test "${last_update}" '>' "${prev_last_update}"
diff --git a/qa/workunits/rbd/rbd_mirror_journal.sh b/qa/workunits/rbd/rbd_mirror_journal.sh
index 54f6aeec8..20a3b87db 100755
--- a/qa/workunits/rbd/rbd_mirror_journal.sh
+++ b/qa/workunits/rbd/rbd_mirror_journal.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
#
# rbd_mirror_journal.sh - test rbd-mirror daemon in journal-based mirroring mode
#
@@ -7,6 +7,8 @@
# socket, temporary files, and launches rbd-mirror daemon.
#
+set -ex
+
. $(dirname $0)/rbd_mirror_helpers.sh
setup
diff --git a/qa/workunits/rbd/rbd_mirror_snapshot.sh b/qa/workunits/rbd/rbd_mirror_snapshot.sh
index c70d48b09..17164c4d5 100755
--- a/qa/workunits/rbd/rbd_mirror_snapshot.sh
+++ b/qa/workunits/rbd/rbd_mirror_snapshot.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
#
# rbd_mirror_snapshot.sh - test rbd-mirror daemon in snapshot-based mirroring mode
#
@@ -7,6 +7,8 @@
# socket, temporary files, and launches rbd-mirror daemon.
#
+set -ex
+
MIRROR_POOL_MODE=image
MIRROR_IMAGE_MODE=snapshot
diff --git a/qa/workunits/rbd/rbd_mirror_stress.sh b/qa/workunits/rbd/rbd_mirror_stress.sh
index cb79aba7e..ea39d3aae 100755
--- a/qa/workunits/rbd/rbd_mirror_stress.sh
+++ b/qa/workunits/rbd/rbd_mirror_stress.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -ex
+#!/usr/bin/env bash
#
# rbd_mirror_stress.sh - stress test rbd-mirror daemon
#
@@ -8,6 +8,8 @@
# tool during the many image test
#
+set -ex
+
IMAGE_COUNT=50
export LOCKDEP=0