]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: split-brain issues should be clearly visible in mirror status
authorMykola Golub <mgolub@mirantis.com>
Tue, 29 Nov 2016 09:40:14 +0000 (11:40 +0200)
committerMykola Golub <mgolub@mirantis.com>
Sat, 3 Dec 2016 17:37:10 +0000 (19:37 +0200)
Fixed: http://tracker.ceph.com/issues/16991
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
qa/workunits/rbd/rbd_mirror.sh
src/tools/rbd_mirror/ImageReplayer.cc

index ee5755caac1789d5133e4bac8d7e12b4d9dd219b..848687a84c96ce7ee6da2547942f6b912ff8e3e2 100755 (executable)
@@ -357,4 +357,16 @@ test -z "$(get_mirror_position ${CLUSTER2} ${POOL} ${image})"
 wait_for_image_replay_stopped ${CLUSTER1} ${POOL} ${image}
 wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'disconnected'
 
+testlog "TEST: split-brain"
+image=split-brain
+create_image ${CLUSTER2} ${POOL} ${image}
+wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+replaying' 'master_position'
+demote_image ${CLUSTER2} ${POOL} ${image}
+wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+stopped'
+promote_image ${CLUSTER1} ${POOL} ${image}
+write_image ${CLUSTER1} ${POOL} ${image} 10
+demote_image ${CLUSTER1} ${POOL} ${image}
+promote_image ${CLUSTER2} ${POOL} ${image}
+wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} 'up+error' 'split-brain'
+
 echo OK
index c8744840995b1645c96918eee1fc928d318333b8..f6bad875fdfdba87c322be5881a2f4ee6485827b 100644 (file)
@@ -429,6 +429,9 @@ void ImageReplayer<I>::handle_bootstrap(int r) {
     dout(5) << "remote image is non-primary or local image is primary" << dendl;
     on_start_fail(0, "remote image is non-primary or local image is primary");
     return;
+  } else if (r == -EEXIST) {
+    on_start_fail(r, "split-brain detected");
+    return;
   } else if (r < 0) {
     on_start_fail(r, "error bootstrapping replay");
     return;