From 9ddb5da3377029d11cb1089102d7146e9ee2537a Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Fri, 11 Aug 2017 14:27:41 +0200 Subject: [PATCH] rbd-mirror: update asok hook name on image rename Fixes: http://tracker.ceph.com/issues/20860 Signed-off-by: Mykola Golub --- qa/workunits/rbd/rbd_mirror.sh | 12 ++++++++++++ qa/workunits/rbd/rbd_mirror_helpers.sh | 10 ++++++++++ src/tools/rbd_mirror/ImageReplayer.cc | 2 ++ 3 files changed, 24 insertions(+) diff --git a/qa/workunits/rbd/rbd_mirror.sh b/qa/workunits/rbd/rbd_mirror.sh index 04a03a66e5cf..5195e6cf3e91 100755 --- a/qa/workunits/rbd/rbd_mirror.sh +++ b/qa/workunits/rbd/rbd_mirror.sh @@ -111,6 +111,18 @@ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image1} 'up+replaying' admin_daemon ${CLUSTER1} rbd mirror flush admin_daemon ${CLUSTER1} rbd mirror status +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} +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} diff --git a/qa/workunits/rbd/rbd_mirror_helpers.sh b/qa/workunits/rbd/rbd_mirror_helpers.sh index 23216711e6ac..325353b91bc7 100755 --- a/qa/workunits/rbd/rbd_mirror_helpers.sh +++ b/qa/workunits/rbd/rbd_mirror_helpers.sh @@ -593,6 +593,16 @@ set_image_meta() rbd --cluster ${cluster} -p ${pool} image-meta set ${image} $key $val } +rename_image() +{ + local cluster=$1 + local pool=$2 + local image=$3 + local new_name=$4 + + rbd --cluster=${cluster} -p ${pool} rename ${image} ${new_name} +} + remove_image() { local cluster=$1 diff --git a/src/tools/rbd_mirror/ImageReplayer.cc b/src/tools/rbd_mirror/ImageReplayer.cc index 65114ee5a19d..8569035647db 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -1235,6 +1235,8 @@ void ImageReplayer::handle_process_entry_ready(int r) { dout(20) << dendl; assert(r == 0); + on_name_changed(); + // attempt to process the next event handle_replay_ready(); } -- 2.47.3