From b02d3b0c5aa59aa294de43f94c793f5abf71ac03 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Mon, 20 Sep 2021 21:52:57 +0200 Subject: [PATCH 1/3] rbd-mirror: unbreak one-way snapshot-based mirroring Snapshot replayer needs the remote's mirror peer uuid to find its snapshots in the remote image. It is obtained by listing remote's mirror peers but RemotePoolPoller::handle_mirror_peer_list() skips tx-only (MIRROR_PEER_DIRECTION_TX) peers. In effect only rx-tx (MIRROR_PEER_DIRECTION_RX_TX) peers are considered for matching and snapshot replayer always fails with "failed to retrieve mirror peer uuid from remote pool" error. Instead, skip rx-only (MIRROR_PEER_DIRECTION_RX) peers as we are definitely not interested in anything having to do with mirroring _to_ the remote cluster. Fixes: https://tracker.ceph.com/issues/52675 Signed-off-by: Ilya Dryomov --- src/tools/rbd_mirror/RemotePoolPoller.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/rbd_mirror/RemotePoolPoller.cc b/src/tools/rbd_mirror/RemotePoolPoller.cc index 4f5994f1da678..1ff2e41fc46d1 100644 --- a/src/tools/rbd_mirror/RemotePoolPoller.cc +++ b/src/tools/rbd_mirror/RemotePoolPoller.cc @@ -183,7 +183,7 @@ void RemotePoolPoller::handle_mirror_peer_list(int r) { cls::rbd::MirrorPeer* matched_peer = nullptr; for (auto& peer : peers) { - if (peer.mirror_peer_direction == cls::rbd::MIRROR_PEER_DIRECTION_TX) { + if (peer.mirror_peer_direction == cls::rbd::MIRROR_PEER_DIRECTION_RX) { continue; } From fdcdeae2a26927b51ab8a480d48a52b896b5532b Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Mon, 20 Sep 2021 22:36:10 +0200 Subject: [PATCH 2/3] rbd-mirror: fix a couple of brainos in log messages Signed-off-by: Ilya Dryomov --- src/tools/rbd_mirror/RemotePoolPoller.cc | 2 +- src/tools/rbd_mirror/Types.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/rbd_mirror/RemotePoolPoller.cc b/src/tools/rbd_mirror/RemotePoolPoller.cc index 1ff2e41fc46d1..8bfb35d4af1ef 100644 --- a/src/tools/rbd_mirror/RemotePoolPoller.cc +++ b/src/tools/rbd_mirror/RemotePoolPoller.cc @@ -16,7 +16,7 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_rbd_mirror #undef dout_prefix -#define dout_prefix *_dout << "rbd::mirror::RemotePollPoller: " << this << " " \ +#define dout_prefix *_dout << "rbd::mirror::RemotePoolPoller: " << this << " " \ << __func__ << ": " namespace rbd { diff --git a/src/tools/rbd_mirror/Types.cc b/src/tools/rbd_mirror/Types.cc index aa9bc7c3fe55f..cd71c73b1cc69 100644 --- a/src/tools/rbd_mirror/Types.cc +++ b/src/tools/rbd_mirror/Types.cc @@ -19,7 +19,7 @@ std::ostream& operator<<(std::ostream& lhs, std::ostream& operator<<(std::ostream& lhs, const RemotePoolMeta& rhs) { return lhs << "mirror_uuid=" << rhs.mirror_uuid << ", " - "mirror_pool_uuid=" << rhs.mirror_peer_uuid; + "mirror_peer_uuid=" << rhs.mirror_peer_uuid; } std::ostream& operator<<(std::ostream& lhs, const PeerSpec &peer) { From 366e9c51a8d83a7c185a00d9fb9e4cde290145e4 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Fri, 24 Sep 2021 12:29:34 +0200 Subject: [PATCH 3/3] qa/suites/rbd: test case for one-way snapshot-based mirroring Signed-off-by: Ilya Dryomov --- ...l => rbd-mirror-journal-bootstrap-workunit.yaml} | 2 ++ .../rbd-mirror-snapshot-bootstrap-workunit.yaml | 13 +++++++++++++ qa/workunits/rbd/rbd_mirror_bootstrap.sh | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) rename qa/suites/rbd/mirror/workloads/{rbd-mirror-bootstrap-workunit.yaml => rbd-mirror-journal-bootstrap-workunit.yaml} (83%) create mode 100644 qa/suites/rbd/mirror/workloads/rbd-mirror-snapshot-bootstrap-workunit.yaml diff --git a/qa/suites/rbd/mirror/workloads/rbd-mirror-bootstrap-workunit.yaml b/qa/suites/rbd/mirror/workloads/rbd-mirror-journal-bootstrap-workunit.yaml similarity index 83% rename from qa/suites/rbd/mirror/workloads/rbd-mirror-bootstrap-workunit.yaml rename to qa/suites/rbd/mirror/workloads/rbd-mirror-journal-bootstrap-workunit.yaml index 585f582913f7c..b9c5562be834d 100644 --- a/qa/suites/rbd/mirror/workloads/rbd-mirror-bootstrap-workunit.yaml +++ b/qa/suites/rbd/mirror/workloads/rbd-mirror-journal-bootstrap-workunit.yaml @@ -9,3 +9,5 @@ tasks: CEPH_ARGS: '' RBD_MIRROR_INSTANCES: '1' RBD_MIRROR_USE_EXISTING_CLUSTER: '1' + MIRROR_POOL_MODE: 'pool' + MIRROR_IMAGE_MODE: 'journal' diff --git a/qa/suites/rbd/mirror/workloads/rbd-mirror-snapshot-bootstrap-workunit.yaml b/qa/suites/rbd/mirror/workloads/rbd-mirror-snapshot-bootstrap-workunit.yaml new file mode 100644 index 0000000000000..5ad78474d3cb2 --- /dev/null +++ b/qa/suites/rbd/mirror/workloads/rbd-mirror-snapshot-bootstrap-workunit.yaml @@ -0,0 +1,13 @@ +meta: +- desc: run the rbd_mirror_bootstrap.sh workunit to test the rbd-mirror daemon +tasks: +- workunit: + clients: + cluster1.client.mirror: [rbd/rbd_mirror_bootstrap.sh] + env: + # override workunit setting of CEPH_ARGS='--cluster' + CEPH_ARGS: '' + RBD_MIRROR_INSTANCES: '1' + RBD_MIRROR_USE_EXISTING_CLUSTER: '1' + MIRROR_POOL_MODE: 'image' + MIRROR_IMAGE_MODE: 'snapshot' diff --git a/qa/workunits/rbd/rbd_mirror_bootstrap.sh b/qa/workunits/rbd/rbd_mirror_bootstrap.sh index e0a096ee8a370..fb77c0d9bf869 100755 --- a/qa/workunits/rbd/rbd_mirror_bootstrap.sh +++ b/qa/workunits/rbd/rbd_mirror_bootstrap.sh @@ -27,7 +27,7 @@ testlog "TEST: verify rx-only direction" [ "$(rbd --cluster ${CLUSTER1} --pool ${POOL} mirror pool info --format xml | ${XMLSTARLET} sel -t -v '//mirror/peers/peer[1]/uuid')" = "" ] -create_image ${CLUSTER1} ${POOL} image1 +create_image_and_enable_mirror ${CLUSTER1} ${POOL} image1 wait_for_image_replay_started ${CLUSTER2} ${POOL} image1 write_image ${CLUSTER1} ${POOL} image1 100