--- /dev/null
+../.qa/
\ No newline at end of file
--- /dev/null
+meta:
+- desc: configure the permissions for client.mirror
+overrides:
+ ceph:
+ conf:
+ client:
+ rbd default features: 125
+ debug rbd: 20
+ debug rbd_mirror: 15
+ log to stderr: false
+ # 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
+tasks:
+- exec:
+ cluster1.client.mirror.0:
+ - "sudo ceph --cluster cluster1 auth caps client.mirror mon 'profile rbd-mirror-peer' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster1 auth caps client.mirror.0 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster1 auth caps client.mirror.1 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster1 auth caps client.mirror.2 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster1 auth caps client.mirror.3 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror mon 'profile rbd-mirror-peer' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror.0 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror.1 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror.2 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror.3 mon 'profile rbd-mirror' osd 'profile rbd'"
+++ /dev/null
-../.qa/
\ No newline at end of file
+++ /dev/null
-meta:
-- desc: configure the permissions for client.mirror
-overrides:
- ceph:
- conf:
- client:
- rbd default features: 125
- debug rbd: 20
- debug rbd_mirror: 15
- log to stderr: false
- # 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: configure the permissions for client.mirror
+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:
+- exec:
+ cluster1.client.mirror.0:
+ - "sudo ceph --cluster cluster1 auth caps client.mirror.4 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster1 auth caps client.mirror.5 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster1 auth caps client.mirror.6 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror.4 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror.5 mon 'profile rbd-mirror' osd 'profile rbd'"
+ - "sudo ceph --cluster cluster2 auth caps client.mirror.6 mon 'profile rbd-mirror' osd 'profile rbd'"
--- /dev/null
+../../mirror-thrash/clients/mirror.yaml
\ No newline at end of file
+++ /dev/null
-../mirror-thrash/users
\ No newline at end of file
conf:
client:
rbd mirror image policy type: none
- # 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:
testlog "TEST: non-default namespace image mirroring"
testlog " - replay"
-create_image ${CLUSTER2} ${POOL}/ns1 ${image}
-create_image ${CLUSTER2} ${POOL}/ns2 ${image}
-enable_mirror ${CLUSTER2} ${POOL}/ns2 ${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL}/ns1 ${image}
-wait_for_image_replay_started ${CLUSTER1} ${POOL}/ns2 ${image}
-write_image ${CLUSTER2} ${POOL}/ns1 ${image} 100
-write_image ${CLUSTER2} ${POOL}/ns2 ${image} 100
-wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL}/ns1 ${image}
-wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL}/ns2 ${image}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL}/ns1 ${image} 'up+replaying' 'master_position'
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL}/ns2 ${image} 'up+replaying' 'master_position'
-compare_images ${POOL}/ns1 ${image}
-compare_images ${POOL}/ns2 ${image}
+create_image ${CLUSTER2} ${POOL}/${NS1} ${image}
+create_image ${CLUSTER2} ${POOL}/${NS2} ${image}
+enable_mirror ${CLUSTER2} ${POOL}/${NS2} ${image}
+wait_for_image_replay_started ${CLUSTER1} ${POOL}/${NS1} ${image}
+wait_for_image_replay_started ${CLUSTER1} ${POOL}/${NS2} ${image}
+write_image ${CLUSTER2} ${POOL}/${NS1} ${image} 100
+write_image ${CLUSTER2} ${POOL}/${NS2} ${image} 100
+wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL}/${NS1} ${image}
+wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL}/${NS2} ${image}
+wait_for_status_in_pool_dir ${CLUSTER1} ${POOL}/${NS1} ${image} 'up+replaying' 'master_position'
+wait_for_status_in_pool_dir ${CLUSTER1} ${POOL}/${NS2} ${image} 'up+replaying' 'master_position'
+compare_images ${POOL}/${NS1} ${image}
+compare_images ${POOL}/${NS2} ${image}
testlog " - disable mirroring / delete image"
-remove_image_retry ${CLUSTER2} ${POOL}/ns1 ${image}
-disable_mirror ${CLUSTER2} ${POOL}/ns2 ${image}
-wait_for_image_present ${CLUSTER1} ${POOL}/ns1 ${image} 'deleted'
-wait_for_image_present ${CLUSTER1} ${POOL}/ns2 ${image} 'deleted'
+remove_image_retry ${CLUSTER2} ${POOL}/${NS1} ${image}
+disable_mirror ${CLUSTER2} ${POOL}/${NS2} ${image}
+wait_for_image_present ${CLUSTER1} ${POOL}/${NS1} ${image} 'deleted'
+wait_for_image_present ${CLUSTER1} ${POOL}/${NS2} ${image} 'deleted'
testlog " - data pool"
dp_image=test_data_pool
-create_image ${CLUSTER2} ${POOL}/ns1 ${dp_image} 128 --data-pool ${PARENT_POOL}
-data_pool=$(get_image_data_pool ${CLUSTER2} ${POOL}/ns1 ${dp_image})
+create_image ${CLUSTER2} ${POOL}/${NS1} ${dp_image} 128 --data-pool ${PARENT_POOL}
+data_pool=$(get_image_data_pool ${CLUSTER2} ${POOL}/${NS1} ${dp_image})
test "${data_pool}" = "${PARENT_POOL}"
-wait_for_image_replay_started ${CLUSTER1} ${POOL}/ns1 ${dp_image}
-data_pool=$(get_image_data_pool ${CLUSTER1} ${POOL}/ns1 ${dp_image})
+wait_for_image_replay_started ${CLUSTER1} ${POOL}/${NS1} ${dp_image}
+data_pool=$(get_image_data_pool ${CLUSTER1} ${POOL}/${NS1} ${dp_image})
test "${data_pool}" = "${PARENT_POOL}"
-write_image ${CLUSTER2} ${POOL}/ns1 ${dp_image} 100
-wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL}/ns1 ${dp_image}
-wait_for_status_in_pool_dir ${CLUSTER1} ${POOL}/ns1 ${dp_image} 'up+replaying' 'master_position'
-compare_images ${POOL}/ns1 ${dp_image}
+write_image ${CLUSTER2} ${POOL}/${NS1} ${dp_image} 100
+wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL}/${NS1} ${dp_image}
+wait_for_status_in_pool_dir ${CLUSTER1} ${POOL}/${NS1} ${dp_image} 'up+replaying' 'master_position'
+compare_images ${POOL}/${NS1} ${dp_image}
testlog "TEST: simple image resync"
request_resync_image ${CLUSTER1} ${POOL} ${image} image_id
PEER_CLUSTER_SUFFIX=
POOL=mirror
PARENT_POOL=mirror_parent
+NS1=ns1
+NS2=ns2
TEMPDIR=
CEPH_ID=${CEPH_ID:-mirror}
MIRROR_USER_ID_PREFIX=${MIRROR_USER_ID_PREFIX:-${CEPH_ID}.}
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-mirror' osd 'profile rbd'
- done
-}
-
setup_cluster()
{
local cluster=$1
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
+ if [ -n "${RBD_MIRROR_CONFIG_KEY}" ]; then
+ PEER_CLUSTER_SUFFIX=-DNE
+ fi
+
+ rbd --cluster ${cluster} mirror pool enable --site-name ${cluster}${PEER_CLUSTER_SUFFIX} ${POOL} pool
rbd --cluster ${cluster} mirror pool enable ${PARENT_POOL} image
- rbd --cluster ${cluster} namespace create ${POOL}/ns1
- rbd --cluster ${cluster} namespace create ${POOL}/ns2
+ rbd --cluster ${cluster} namespace create ${POOL}/${NS1}
+ rbd --cluster ${cluster} namespace create ${POOL}/${NS2}
- rbd --cluster ${cluster} mirror pool enable ${POOL}/ns1 pool
- rbd --cluster ${cluster} mirror pool enable ${POOL}/ns2 image
+ rbd --cluster ${cluster} mirror pool enable ${POOL}/${NS1} pool
+ rbd --cluster ${cluster} mirror pool enable ${POOL}/${NS2} image
if [ -z ${RBD_MIRROR_MANUAL_PEERS} ]; then
if [ -z ${RBD_MIRROR_CONFIG_KEY} ]; then
admin_key_file=${TEMPDIR}/${remote_cluster}.client.${CEPH_ID}.key
CEPH_ARGS='' ceph --cluster ${remote_cluster} auth get-key client.${CEPH_ID} > ${admin_key_file}
- rbd --cluster ${cluster} mirror pool peer add ${POOL} client.${CEPH_ID}@${remote_cluster}-DNE \
+ rbd --cluster ${cluster} mirror pool peer add ${POOL} \
+ client.${CEPH_ID}@${remote_cluster}${PEER_CLUSTER_SUFFIX} \
--remote-mon-host "${mon_addr}" --remote-key-file ${admin_key_file}
- uuid=$(rbd --cluster ${cluster} mirror pool peer add ${PARENT_POOL} client.${CEPH_ID}@${remote_cluster}-DNE)
+ uuid=$(rbd --cluster ${cluster} mirror pool peer add ${PARENT_POOL} \
+ client.${CEPH_ID}@${remote_cluster}${PEER_CLUSTER_SUFFIX})
rbd --cluster ${cluster} mirror pool peer set ${PARENT_POOL} ${uuid} mon-host ${mon_addr}
rbd --cluster ${cluster} mirror pool peer set ${PARENT_POOL} ${uuid} key-file ${admin_key_file}
-
- PEER_CLUSTER_SUFFIX=-DNE
fi
fi
}
if [ -z "${RBD_MIRROR_USE_EXISTING_CLUSTER}" ]; then
setup_cluster "${CLUSTER1}"
setup_cluster "${CLUSTER2}"
- else
- update_users "${CLUSTER1}"
- update_users "${CLUSTER2}"
fi
setup_pools "${CLUSTER1}" "${CLUSTER2}"
status()
{
- local cluster daemon image_pool image
+ local cluster daemon image_pool image_ns image
for cluster in ${CLUSTER1} ${CLUSTER2}
do
for image_pool in ${POOL} ${PARENT_POOL}
do
- echo "${cluster} ${image_pool} images"
- rbd --cluster ${cluster} -p ${image_pool} ls -l
- echo
-
- echo "${cluster} ${image_pool} mirror pool status"
- rbd --cluster ${cluster} -p ${image_pool} mirror pool status --verbose
- echo
+ for image_ns in "" "/${NS1}" "/${NS2}"
+ do
+ echo "${cluster} ${image_pool}${image_ns} images"
+ rbd --cluster ${cluster} -p ${image_pool}{$image_ns} ls -l
+ echo
- for image in `rbd --cluster ${cluster} -p ${image_pool} ls 2>/dev/null`
- do
- echo "image ${image} info"
- rbd --cluster ${cluster} -p ${image_pool} info ${image}
+ echo "${cluster} ${image_pool}${image_ns} mirror pool info"
+ rbd --cluster ${cluster} -p ${image_pool}${image_ns} mirror pool info
echo
- echo "image ${image} journal status"
- rbd --cluster ${cluster} -p ${image_pool} journal status --image ${image}
+
+ echo "${cluster} ${image_pool}${image_ns} mirror pool status"
+ rbd --cluster ${cluster} -p ${image_pool}${image_ns} mirror pool status --verbose
echo
- done
+
+ for image in `rbd --cluster ${cluster} -p ${image_pool}${image_ns} ls 2>/dev/null`
+ do
+ echo "image ${image} info"
+ rbd --cluster ${cluster} -p ${image_pool}${image_ns} info ${image}
+ echo
+ echo "image ${image} journal status"
+ rbd --cluster ${cluster} -p ${image_pool}${image_ns} journal status --image ${image}
+ echo
+ done
+
+ echo "${cluster} ${image_pool}${image_ns} rbd_mirroring omap vals"
+ rados --cluster ${cluster} -p ${image_pool}${image_ns} listomapvals rbd_mirroring
+ echo
+ done
done
done
local status_log=${TEMPDIR}/$(mkfname ${cluster}-${pool}-${image}.mirror_status)
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
+ grep "^ state: .*${state_pattern}" ${status_log} || return 1
+ grep "^ description: .*${description_pattern}" ${status_log} || return 1
if [ -n "${service_pattern}" ]; then
grep "service: *${service_pattern}" ${status_log} || return 1
# 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="$(sed -nEe 's/^ last_update: *(.*) *$/\1/p' ${status_log})"
test_mirror_pool_status_verbose \
${cluster} ${pool} ${image} "${state_pattern}" "${last_update}" &&
return 0