+++ /dev/null
-../mirror/base
\ No newline at end of file
+++ /dev/null
-../mirror/cluster
\ No newline at end of file
+++ /dev/null
-../mirror/msgr-failures
\ No newline at end of file
+++ /dev/null
-../mirror/objectstore
\ No newline at end of file
+++ /dev/null
-meta:
-- desc: run the rbd_mirror_ha.sh workunit to test the rbd-mirror daemon
-tasks:
-- exec:
- cluster1.client.mirror:
- - ceph --cluster cluster1 auth caps client.mirror mon 'profile rbd' osd 'profile rbd'
- cluster2.client.mirror:
- - ceph --cluster cluster2 auth caps client.mirror mon 'profile rbd' osd 'profile rbd'
-- workunit:
- clients:
- cluster1.client.mirror: [rbd/rbd_mirror_ha.sh]
- env:
- # override workunit setting of CEPH_ARGS='--cluster'
- CEPH_ARGS: ''
- RBD_MIRROR_USE_EXISTING_CLUSTER: '1'
- timeout: 6h
--- /dev/null
+meta:
+- desc: run two ceph clusters and install rbd-mirror
+tasks:
+- install:
+ extra_packages: [rbd-mirror]
+- ceph:
+ cluster: cluster1
+- ceph:
+ cluster: cluster2
--- /dev/null
+meta:
+- desc: 2 ceph clusters with 1 mon and 3 osds each
+roles:
+- - cluster1.mon.a
+ - cluster1.mgr.x
+ - cluster2.mgr.x
+ - cluster1.osd.0
+ - cluster1.osd.1
+ - cluster1.osd.2
+ - cluster1.client.0
+ - cluster2.client.0
+- - cluster2.mon.a
+ - cluster2.osd.0
+ - cluster2.osd.1
+ - cluster2.osd.2
+ - cluster1.client.mirror
+ - cluster1.client.mirror.0
+ - cluster1.client.mirror.1
+ - cluster1.client.mirror.2
+ - cluster1.client.mirror.3
+ - cluster2.client.mirror
+ - cluster2.client.mirror.0
+ - cluster2.client.mirror.1
+ - cluster2.client.mirror.2
+ - cluster2.client.mirror.3
--- /dev/null
+openstack:
+ - volumes: # attached to each instance
+ count: 3
+ size: 30 # GB
--- /dev/null
+../basic/msgr-failures
\ No newline at end of file
--- /dev/null
+../../../objectstore
\ No newline at end of file
--- /dev/null
+meta:
+- desc: run four rbd-mirror daemons per cluster
+tasks:
+- rbd-mirror:
+ client: cluster1.client.mirror.0
+- rbd-mirror:
+ client: cluster1.client.mirror.1
+- rbd-mirror:
+ client: cluster1.client.mirror.2
+- rbd-mirror:
+ client: cluster1.client.mirror.3
+- rbd-mirror:
+ client: cluster2.client.mirror.0
+- rbd-mirror:
+ client: cluster2.client.mirror.1
+- rbd-mirror:
+ client: cluster2.client.mirror.2
+- rbd-mirror:
+ client: cluster2.client.mirror.3
+- rbd-mirror-thrash:
+ cluster: cluster1
+- rbd-mirror-thrash:
+ cluster: cluster2
--- /dev/null
+meta:
+- desc: configure the permissions for client.mirror
+overrides:
+ ceph:
+ conf:
+ # override to make these names predictable
+ client.mirror.0:
+ admin socket: /var/run/ceph/rbd-mirror.$cluster-$name.asok
+ pid file: /var/run/ceph/rbd-mirror.$cluster-$name.pid
+ client.mirror.1:
+ admin socket: /var/run/ceph/rbd-mirror.$cluster-$name.asok
+ pid file: /var/run/ceph/rbd-mirror.$cluster-$name.pid
+ client.mirror.2:
+ admin socket: /var/run/ceph/rbd-mirror.$cluster-$name.asok
+ pid file: /var/run/ceph/rbd-mirror.$cluster-$name.pid
+ client.mirror.3:
+ admin socket: /var/run/ceph/rbd-mirror.$cluster-$name.asok
+ pid file: /var/run/ceph/rbd-mirror.$cluster-$name.pid
--- /dev/null
+meta:
+- desc: run the rbd_mirror_stress.sh workunit to test the rbd-mirror daemon
+tasks:
+- workunit:
+ clients:
+ cluster1.client.mirror: [rbd/rbd_mirror_stress.sh]
+ env:
+ # override workunit setting of CEPH_ARGS='--cluster'
+ CEPH_ARGS: ''
+ RBD_MIRROR_INSTANCES: '4'
+ RBD_MIRROR_USE_EXISTING_CLUSTER: '1'
+ RBD_MIRROR_USE_RBD_MIRROR: '1'
+ timeout: 6h
--- /dev/null
+meta:
+- desc: run the rbd_mirror.sh workunit to test the rbd-mirror daemon
+tasks:
+- workunit:
+ clients:
+ cluster1.client.mirror: [rbd/rbd_mirror.sh]
+ env:
+ # override workunit setting of CEPH_ARGS='--cluster'
+ CEPH_ARGS: ''
+ RBD_MIRROR_INSTANCES: '4'
+ RBD_MIRROR_USE_EXISTING_CLUSTER: '1'
+ RBD_MIRROR_USE_RBD_MIRROR: '1'
--- /dev/null
+../mirror-thrash/base
\ No newline at end of file
+++ /dev/null
-meta:
-- desc: run two ceph clusters and install rbd-mirror
-tasks:
-- install:
- extra_packages: [rbd-mirror]
-- ceph:
- cluster: cluster1
-- ceph:
- cluster: cluster2
roles:
- - cluster1.mon.a
- cluster1.mgr.x
+ - cluster2.mgr.x
- cluster1.osd.0
- cluster1.osd.1
- cluster1.osd.2
- cluster1.client.0
- cluster2.client.0
- - cluster2.mon.a
- - cluster2.mgr.x
- cluster2.osd.0
- cluster2.osd.1
- cluster2.osd.2
- cluster1.client.mirror
+ - cluster1.client.mirror.0
+ - cluster1.client.mirror.1
+ - cluster1.client.mirror.2
+ - cluster1.client.mirror.3
+ - cluster1.client.mirror.4
+ - cluster1.client.mirror.5
+ - cluster1.client.mirror.6
- cluster2.client.mirror
+ - cluster2.client.mirror.0
+ - cluster2.client.mirror.1
+ - cluster2.client.mirror.2
+ - cluster2.client.mirror.3
+ - cluster2.client.mirror.4
+ - cluster2.client.mirror.5
+ - cluster2.client.mirror.6
+++ /dev/null
-openstack:
- - volumes: # attached to each instance
- count: 3
- size: 30 # GB
-../basic/msgr-failures
\ No newline at end of file
+../mirror-thrash/msgr-failures
\ No newline at end of file
-../../../objectstore
\ No newline at end of file
+../mirror-thrash/objectstore
\ No newline at end of file
+++ /dev/null
-meta:
-- desc: run one rbd-mirror daemon per cluster
-overrides:
- ceph:
- conf:
- client.mirror:
- # override to make these names predictable
- admin socket: /var/run/ceph/$cluster-$name.asok
- pid file: /var/run/ceph/$cluster-$name.pid
-tasks:
-- exec:
- cluster1.client.mirror:
- - ceph --cluster cluster1 auth caps client.mirror mon 'profile rbd' osd 'profile rbd'
- cluster2.client.mirror:
- - ceph --cluster cluster2 auth caps client.mirror mon 'profile rbd' osd 'profile rbd'
-- rbd-mirror:
- client: cluster1.client.mirror
-- rbd-mirror:
- client: cluster2.client.mirror
--- /dev/null
+../mirror-thrash/users
\ No newline at end of file
--- /dev/null
+meta:
+- desc: run the rbd_mirror_ha.sh workunit to test the rbd-mirror daemon
+overrides:
+ ceph:
+ conf:
+ # override to make these names predictable
+ client.mirror.4:
+ admin socket: /var/run/ceph/rbd-mirror.$cluster-$name.asok
+ pid file: /var/run/ceph/rbd-mirror.$cluster-$name.pid
+ client.mirror.5:
+ admin socket: /var/run/ceph/rbd-mirror.$cluster-$name.asok
+ pid file: /var/run/ceph/rbd-mirror.$cluster-$name.pid
+ client.mirror.6:
+ admin socket: /var/run/ceph/rbd-mirror.$cluster-$name.asok
+ pid file: /var/run/ceph/rbd-mirror.$cluster-$name.pid
+tasks:
+- workunit:
+ clients:
+ cluster1.client.mirror: [rbd/rbd_mirror_ha.sh]
+ env:
+ # override workunit setting of CEPH_ARGS='--cluster'
+ CEPH_ARGS: ''
+ RBD_MIRROR_USE_EXISTING_CLUSTER: '1'
+ timeout: 6h
+++ /dev/null
-meta:
-- desc: run the rbd_mirror_stress.sh workunit to test the rbd-mirror daemon
-tasks:
-- workunit:
- clients:
- cluster1.client.mirror: [rbd/rbd_mirror_stress.sh]
- env:
- # override workunit setting of CEPH_ARGS='--cluster'
- CEPH_ARGS: ''
- RBD_MIRROR_USE_EXISTING_CLUSTER: '1'
- RBD_MIRROR_USE_RBD_MIRROR: '1'
- timeout: 6h
env:
# override workunit setting of CEPH_ARGS='--cluster'
CEPH_ARGS: ''
+ RBD_MIRROR_INSTANCES: '4'
RBD_MIRROR_USE_EXISTING_CLUSTER: '1'
- RBD_MIRROR_USE_RBD_MIRROR: '1'
. $(dirname $0)/rbd_mirror_helpers.sh
testlog "TEST: add image and test replay"
-start_mirror ${CLUSTER1}
+start_mirrors ${CLUSTER1}
image=test
create_image ${CLUSTER2} ${POOL} ${image}
set_image_meta ${CLUSTER2} ${POOL} ${image} "key1" "value1"
compare_image_meta ${CLUSTER1} ${POOL} ${image} "key2" "value2"
testlog "TEST: stop mirror, add image, start mirror and test replay"
-stop_mirror ${CLUSTER1}
+stop_mirrors ${CLUSTER1}
image1=test1
create_image ${CLUSTER2} ${POOL} ${image1}
write_image ${CLUSTER2} ${POOL} ${image1} 100
-start_mirror ${CLUSTER1}
+start_mirrors ${CLUSTER1}
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${image1}
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying' 'master_position'
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
compare_images ${POOL} ${image}
-testlog "TEST: stop/start/restart mirror via admin socket"
-admin_daemon ${CLUSTER1} rbd mirror stop
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
-
-admin_daemon ${CLUSTER1} rbd mirror start
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
-
-admin_daemon ${CLUSTER1} rbd mirror restart
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
-
-admin_daemon ${CLUSTER1} rbd mirror stop
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
-
-admin_daemon ${CLUSTER1} rbd mirror restart
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
-
-admin_daemon ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
-
-admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
-
-admin_daemon ${CLUSTER1} rbd mirror start ${POOL} ${CLUSTER2}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
-
-admin_daemon ${CLUSTER1} rbd mirror restart ${POOL}/${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
-
-admin_daemon ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
-
-admin_daemon ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
-
-admin_daemon ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
-
-admin_daemon ${CLUSTER1} rbd mirror flush
-admin_daemon ${CLUSTER1} rbd mirror status
+if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
+ testlog "TEST: stop/start/restart mirror via admin socket"
+ all_admin_daemons ${CLUSTER1} rbd mirror stop
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror start
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror restart
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror stop
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror restart
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
+
+ admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror start ${POOL} ${CLUSTER2}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
+
+ admin_daemons ${CLUSTER1} rbd mirror restart ${POOL}/${image}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
+
+ all_admin_daemons ${CLUSTER1} rbd mirror stop ${POOL} ${CLUSTER2}
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+stopped'
+
+ all_admin_daemons ${CLUSTER1} rbd mirror restart ${POOL} ${CLUSTER2}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image1}
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying'
+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying'
+
+ flush ${CLUSTER1}
+ all_admin_daemons ${CLUSTER1} rbd mirror status
+fi
testlog "TEST: test image rename"
new_name="${image}_RENAMED"
rename_image ${CLUSTER2} ${POOL} ${image} ${new_name}
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${new_name}
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${new_name} 'up+replaying'
-admin_daemon ${CLUSTER1} rbd mirror status ${POOL}/${new_name}
-admin_daemon ${CLUSTER1} rbd mirror restart ${POOL}/${new_name}
+admin_daemons ${CLUSTER1} rbd mirror status ${POOL}/${new_name}
+admin_daemons ${CLUSTER1} rbd mirror restart ${POOL}/${new_name}
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${new_name}
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${new_name} 'up+replaying'
rename_image ${CLUSTER2} ${POOL} ${new_name} ${image}
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
testlog "TEST: failover and failback"
-start_mirror ${CLUSTER2}
+start_mirrors ${CLUSTER2}
# demote and promote same cluster
demote_image ${CLUSTER2} ${POOL} ${image}
wait_for_snap_present ${CLUSTER1} ${POOL} ${image2} "${snap_name}_${i}"
testlog "TEST: disable mirror while daemon is stopped"
-stop_mirror ${CLUSTER1}
-stop_mirror ${CLUSTER2}
+stop_mirrors ${CLUSTER1}
+stop_mirrors ${CLUSTER2}
set_pool_mirror_mode ${CLUSTER2} ${POOL} 'image'
disable_mirror ${CLUSTER2} ${POOL} ${image}
if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
test_image_present ${CLUSTER1} ${POOL} ${image} 'present'
fi
-start_mirror ${CLUSTER1}
+start_mirrors ${CLUSTER1}
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted'
set_pool_mirror_mode ${CLUSTER2} ${POOL} 'pool'
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
compare_images ${POOL} ${image}
testlog "TEST: image resync while replayer is stopped"
-admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
+admin_daemons ${CLUSTER1} rbd mirror stop ${POOL}/${image}
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
-admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
+admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
-admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
+admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
compare_images ${POOL} ${image}
testlog "TEST: request image resync while daemon is offline"
-stop_mirror ${CLUSTER1}
+stop_mirrors ${CLUSTER1}
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
-start_mirror ${CLUSTER1}
+start_mirrors ${CLUSTER1}
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'deleted' ${image_id}
wait_for_image_present ${CLUSTER1} ${POOL} ${image} 'present'
wait_for_image_replay_started ${CLUSTER1} ${POOL} ${image}
compare_images ${POOL} ${image}
testlog " - disconnected after max_concurrent_object_sets reached"
-admin_daemon ${CLUSTER1} rbd mirror stop ${POOL}/${image}
+admin_daemons ${CLUSTER1} rbd mirror stop ${POOL}/${image}
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
test -n "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
set_image_meta ${CLUSTER2} ${POOL} ${image} \
conf_rbd_journal_max_concurrent_object_sets 0
testlog " - replay is still stopped (disconnected) after restart"
-admin_daemon ${CLUSTER1} rbd mirror start ${POOL}/${image}
+admin_daemons ${CLUSTER1} rbd mirror start ${POOL}/${image}
wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
-testlog "TEST: no blacklists"
-CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER1} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
-CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER2} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
+if [ -z "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
+ # teuthology will trash the daemon
+ testlog "TEST: no blacklists"
+ CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER1} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
+ CEPH_ARGS='--id admin' ceph --cluster ${CLUSTER2} osd blacklist ls 2>&1 | grep -q "listed 0 entries"
+fi
echo OK
# rbd_mirror_ha.sh - test rbd-mirror daemons in HA mode
#
+RBD_MIRROR_INSTANCES=${RBD_MIRROR_INSTANCES:-7}
+
. $(dirname $0)/rbd_mirror_helpers.sh
is_leader()
for s in 1 1 2 4 4 4 4 4 8 8 8 8 16 16 32 64; do
sleep $s
- for instance in `seq 0 9`; do
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
is_leader ${instance} || continue
LEADER=${instance}
return 0
-#!/bin/sh
+#!/bin/sh -x
#
# rbd_mirror_helpers.sh - shared rbd-mirror daemon helper functions
#
# rbd-mirror daemons.
# RBD_MIRROR_VARGS - use this to pass additional arguments to vstart.sh
# when starting clusters.
+# RBD_MIRROR_INSTANCES - number of daemons to start per cluster
#
# The cleanup can be done as a separate step, running the script with
# `cleanup ${RBD_MIRROR_TEMDIR}' arguments.
# ../qa/workunits/rbd/rbd_mirror.sh cleanup
#
+RBD_MIRROR_INSTANCES=${RBD_MIRROR_INSTANCES:-2}
+
CLUSTER1=cluster1
CLUSTER2=cluster2
POOL=mirror
PARENT_POOL=mirror_parent
TEMPDIR=
-USER_ID=mirror
-export CEPH_ARGS="--id ${USER_ID}"
+CEPH_ID=${CEPH_ID:-mirror}
+MIRROR_USER_ID_PREFIX=${MIRROR_USER_ID_PREFIX:-${CEPH_ID}.}
+export CEPH_ARGS="--id ${CEPH_ID}"
+
+LAST_MIRROR_INSTANCE=$((${RBD_MIRROR_INSTANCES} - 1))
CEPH_ROOT=$(readlink -f $(dirname $0)/../../../src)
CEPH_BIN=.
set_cluster_instance "${local_cluster}" local_cluster instance
- if [ -n "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
- echo $(ceph-conf --cluster $local_cluster --name "client.${CEPH_ID}" 'admin socket')
- else
- echo "${TEMPDIR}/rbd-mirror.${local_cluster}_daemon.${instance}.${cluster}.asok"
- fi
+ echo $(ceph-conf --cluster $local_cluster --name "client.${MIRROR_USER_ID_PREFIX}${instance}" 'admin socket')
}
daemon_pid_file()
set_cluster_instance "${cluster}" cluster instance
- if [ -n "${RBD_MIRROR_USE_RBD_MIRROR}" ]; then
- echo $(ceph-conf --cluster $cluster --name "client.${CEPH_ID}" 'pid file')
- else
- echo "${TEMPDIR}/rbd-mirror.${cluster}_daemon.${instance}.pid"
- fi
+ echo $(ceph-conf --cluster $cluster --name "client.${MIRROR_USER_ID_PREFIX}${instance}" 'pid file')
}
testlog()
return 0
}
+create_users()
+{
+ local cluster=$1
+
+ CEPH_ARGS='' ceph --cluster "${cluster}" \
+ auth get-or-create client.${CEPH_ID} \
+ mon 'profile rbd' osd 'profile rbd' >> \
+ ${CEPH_ROOT}/run/${cluster}/keyring
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ CEPH_ARGS='' ceph --cluster "${cluster}" \
+ auth get-or-create client.${MIRROR_USER_ID_PREFIX}${instance} \
+ mon 'profile rbd' osd 'profile rbd' >> \
+ ${CEPH_ROOT}/run/${cluster}/keyring
+ done
+}
+
+update_users()
+{
+ local cluster=$1
+
+ CEPH_ARGS='' ceph --cluster "${cluster}" \
+ auth caps client.${CEPH_ID} \
+ mon 'profile rbd' osd 'profile rbd'
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ CEPH_ARGS='' ceph --cluster "${cluster}" \
+ auth caps client.${MIRROR_USER_ID_PREFIX}${instance} \
+ mon 'profile rbd' osd 'profile rbd'
+ done
+}
+
+setup_cluster()
+{
+ local cluster=$1
+
+ CEPH_ARGS='' ${CEPH_SRC}/mstart.sh ${cluster} -n ${RBD_MIRROR_VARGS}
+
+ cd ${CEPH_ROOT}
+ rm -f ${TEMPDIR}/${cluster}.conf
+ ln -s $(readlink -f run/${cluster}/ceph.conf) \
+ ${TEMPDIR}/${cluster}.conf
+
+ cd ${TEMPDIR}
+ create_users "${cluster}"
+
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ cat<<EOF >> ${TEMPDIR}/${cluster}.conf
+[client.${MIRROR_USER_ID_PREFIX}${instance}]
+ admin socket = ${TEMPDIR}/rbd-mirror.\$cluster-\$name.asok
+ pid file = ${TEMPDIR}/rbd-mirror.\$cluster-\$name.pid
+EOF
+ done
+}
+
+setup_pools()
+{
+ local cluster=$1
+ local remote_cluster=$2
+
+ CEPH_ARGS='' ceph --cluster ${cluster} osd pool create ${POOL} 64 64
+ CEPH_ARGS='' ceph --cluster ${cluster} osd pool create ${PARENT_POOL} 64 64
+
+ CEPH_ARGS='' rbd --cluster ${cluster} pool init ${POOL}
+ CEPH_ARGS='' rbd --cluster ${cluster} pool init ${PARENT_POOL}
+
+ rbd --cluster ${cluster} mirror pool enable ${POOL} pool
+ rbd --cluster ${cluster} mirror pool enable ${PARENT_POOL} image
+
+ rbd --cluster ${cluster} mirror pool peer add ${POOL} ${remote_cluster}
+ rbd --cluster ${cluster} mirror pool peer add ${PARENT_POOL} ${remote_cluster}
+}
+
setup()
{
local c
fi
if [ -z "${RBD_MIRROR_USE_EXISTING_CLUSTER}" ]; then
- cd ${CEPH_ROOT}
- CEPH_ARGS='' ${CEPH_SRC}/mstart.sh ${CLUSTER1} -n ${RBD_MIRROR_VARGS}
- CEPH_ARGS='' ${CEPH_SRC}/mstart.sh ${CLUSTER2} -n ${RBD_MIRROR_VARGS}
-
- CEPH_ARGS='' ceph --conf run/${CLUSTER1}/ceph.conf \
- auth get-or-create client.${USER_ID} mon 'profile rbd' osd 'profile rbd' >> \
- run/${CLUSTER1}/keyring
- CEPH_ARGS='' ceph --conf run/${CLUSTER2}/ceph.conf \
- auth get-or-create client.${USER_ID} mon 'profile rbd' osd 'profile rbd' >> \
- run/${CLUSTER2}/keyring
-
- rm -f ${TEMPDIR}/${CLUSTER1}.conf
- ln -s $(readlink -f run/${CLUSTER1}/ceph.conf) \
- ${TEMPDIR}/${CLUSTER1}.conf
- rm -f ${TEMPDIR}/${CLUSTER2}.conf
- ln -s $(readlink -f run/${CLUSTER2}/ceph.conf) \
- ${TEMPDIR}/${CLUSTER2}.conf
-
- cd ${TEMPDIR}
+ setup_cluster "${CLUSTER1}"
+ setup_cluster "${CLUSTER2}"
+ else
+ update_users "${CLUSTER1}"
+ update_users "${CLUSTER2}"
fi
- CEPH_ARGS='' ceph --cluster ${CLUSTER1} osd pool create ${POOL} 64 64
- CEPH_ARGS='' ceph --cluster ${CLUSTER1} osd pool create ${PARENT_POOL} 64 64
- CEPH_ARGS='' ceph --cluster ${CLUSTER2} osd pool create ${PARENT_POOL} 64 64
- CEPH_ARGS='' ceph --cluster ${CLUSTER2} osd pool create ${POOL} 64 64
-
- CEPH_ARGS='' rbd --cluster ${CLUSTER1} pool init ${POOL}
- CEPH_ARGS='' rbd --cluster ${CLUSTER2} pool init ${POOL}
- CEPH_ARGS='' rbd --cluster ${CLUSTER1} pool init ${PARENT_POOL}
- CEPH_ARGS='' rbd --cluster ${CLUSTER2} pool init ${PARENT_POOL}
-
- rbd --cluster ${CLUSTER1} mirror pool enable ${POOL} pool
- rbd --cluster ${CLUSTER2} mirror pool enable ${POOL} pool
- rbd --cluster ${CLUSTER1} mirror pool enable ${PARENT_POOL} image
- rbd --cluster ${CLUSTER2} mirror pool enable ${PARENT_POOL} image
-
- rbd --cluster ${CLUSTER1} mirror pool peer add ${POOL} ${CLUSTER2}
- rbd --cluster ${CLUSTER2} mirror pool peer add ${POOL} ${CLUSTER1}
- rbd --cluster ${CLUSTER1} mirror pool peer add ${PARENT_POOL} ${CLUSTER2}
- rbd --cluster ${CLUSTER2} mirror pool peer add ${PARENT_POOL} ${CLUSTER1}
+ setup_pools "${CLUSTER1}" "${CLUSTER2}"
+ setup_pools "${CLUSTER2}" "${CLUSTER1}"
}
cleanup()
set +e
for cluster in "${CLUSTER1}" "${CLUSTER2}"; do
- for instance in `seq 0 9`; do
- stop_mirror "${cluster}:${instance}"
- done
+ stop_mirrors "${cluster}"
done
if [ -z "${RBD_MIRROR_USE_EXISTING_CLUSTER}" ]; then
rbd-mirror \
--cluster ${cluster} \
- --id mirror \
- --pid-file=$(daemon_pid_file "${cluster}:${instance}") \
+ --id ${MIRROR_USER_ID_PREFIX}${instance} \
--log-file=${TEMPDIR}/rbd-mirror.${cluster}_daemon.${instance}.log \
- --admin-socket=${TEMPDIR}/rbd-mirror.${cluster}_daemon.${instance}.\$cluster.asok \
--rbd-mirror-delete-retry-interval=5 \
--rbd-mirror-image-state-check-interval=5 \
--rbd-mirror-journal-poll-age=1 \
${RBD_MIRROR_ARGS}
}
+start_mirrors()
+{
+ local cluster=$1
+
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ start_mirror "${cluster}:${instance}"
+ done
+}
+
stop_mirror()
{
local cluster=$1
rm -f $(daemon_pid_file "${cluster}")
}
+stop_mirrors()
+{
+ local cluster=$1
+ local sig=$2
+
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ stop_mirror "${cluster}:${instance}" "${sig}"
+ done
+}
+
admin_daemon()
{
local cluster=$1 ; shift
ceph --admin-daemon ${asok_file} $@
}
+admin_daemons()
+{
+ local cluster_instance=$1 ; shift
+ local cluster="${cluster_instance%:*}"
+ local instance="${cluster_instance##*:}"
+
+ if [ "${instance}" != "${cluster_instance}" ]; then
+ admin_daemon "${cluster}:${instance}" $@
+ else
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ admin_daemon "${cluster}:${instance}" $@ && return 0
+ done
+ fi
+}
+
+all_admin_daemons()
+{
+ local cluster=$1 ; shift
+
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ admin_daemon "${cluster}" $@
+ done
+}
+
status()
{
local cluster daemon image_pool image
for cluster in "${CLUSTER1}" "${CLUSTER2}"
do
- local pid_file=$(daemon_pid_file ${cluster} )
- if [ ! -e ${pid_file} ]
- then
- echo "${cluster} rbd-mirror not running or unknown" \
- "(${pid_file} not exist)"
- continue
- fi
-
- local pid
- pid=$(cat ${pid_file} 2>/dev/null) || :
- if [ -z "${pid}" ]
- then
- echo "${cluster} rbd-mirror not running or unknown" \
- "(can't find pid using ${pid_file})"
- ret=1
- continue
- fi
-
- echo "${daemon} rbd-mirror process in ps output:"
- if ps auxww |
+ for instance in `seq 0 ${LAST_MIRROR_INSTANCE}`; do
+ local pid_file=$(daemon_pid_file ${cluster}:${instance})
+ if [ ! -e ${pid_file} ]
+ then
+ echo "${cluster} rbd-mirror not running or unknown" \
+ "(${pid_file} not exist)"
+ continue
+ fi
+
+ local pid
+ pid=$(cat ${pid_file} 2>/dev/null) || :
+ if [ -z "${pid}" ]
+ then
+ echo "${cluster} rbd-mirror not running or unknown" \
+ "(can't find pid using ${pid_file})"
+ ret=1
+ continue
+ fi
+
+ echo "${daemon} rbd-mirror process in ps output:"
+ if ps auxww |
awk -v pid=${pid} 'NR == 1 {print} $2 == pid {print; exit 1}'
- then
+ then
+ echo
+ echo "${cluster} rbd-mirror not running" \
+ "(can't find pid $pid in ps output)"
+ ret=1
+ continue
+ fi
echo
- echo "${cluster} rbd-mirror not running" \
- "(can't find pid $pid in ps output)"
- ret=1
- continue
- fi
- echo
- local asok_file=$(daemon_asok_file ${cluster} ${cluster})
- if [ ! -S "${asok_file}" ]
- then
- echo "${cluster} rbd-mirror asok is unknown (${asok_file} not exits)"
- ret=1
- continue
- fi
+ local asok_file=$(daemon_asok_file ${cluster}:${instance} ${cluster})
+ if [ ! -S "${asok_file}" ]
+ then
+ echo "${cluster} rbd-mirror asok is unknown (${asok_file} not exits)"
+ ret=1
+ continue
+ fi
- echo "${cluster} rbd-mirror status"
- ceph --admin-daemon ${asok_file} rbd mirror status
- echo
+ echo "${cluster} rbd-mirror status"
+ ceph --admin-daemon ${asok_file} rbd mirror status
+ echo
+ done
done
return ${ret}
cmd="${cmd} ${pool}/${image}"
fi
- admin_daemon "${cluster}" ${cmd}
+ for s in 1 2 4 8 8 8 8 8 8 8 8 16 16; do
+ sleep ${s}
+ admin_daemons "${cluster}" ${cmd} && return 0
+ done
+ return 1
}
test_image_replay_state()
local test_state=$4
local current_state=stopped
- admin_daemon "${cluster}" help |
- fgrep "\"rbd mirror status ${pool}/${image}\"" &&
- admin_daemon "${cluster}" rbd mirror status ${pool}/${image} |
- grep -i 'state.*Replaying' &&
- current_state=started
-
+ admin_daemons "${cluster}" rbd mirror status ${pool}/${image} |
+ grep -i 'state.*Replaying' && current_state=started
test "${test_state}" = "${current_state}"
}
return 1
}
-start_mirror ${CLUSTER1}
-start_mirror ${CLUSTER2}
+start_mirrors ${CLUSTER1}
+start_mirrors ${CLUSTER2}
testlog "TEST: add image and test replay after client crashes"
image=test