From 4f74856f6547757253176fb743ad6841d68bcaf0 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Wed, 23 Mar 2016 17:06:46 +0000 Subject: [PATCH] rbd: rbd-mirroring: Replayer registers in remote journal with mirror_uuid Signed-off-by: Ricardo Dias Fixes: #15238 --- src/tools/rbd_mirror/Replayer.cc | 20 ++++++++++---------- src/tools/rbd_mirror/Replayer.h | 1 - 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/tools/rbd_mirror/Replayer.cc b/src/tools/rbd_mirror/Replayer.cc index 620a6a848ef55..d3c914d9f851b 100644 --- a/src/tools/rbd_mirror/Replayer.cc +++ b/src/tools/rbd_mirror/Replayer.cc @@ -6,6 +6,7 @@ #include "common/debug.h" #include "common/errno.h" #include "include/stringify.h" +#include "cls/rbd/cls_rbd_client.h" #include "Replayer.h" #define dout_subsys ceph_subsys_rbd_mirror @@ -89,15 +90,6 @@ int Replayer::init() dout(20) << "connected to " << m_peer << dendl; - std::string uuid; - r = m_local->cluster_fsid(&uuid); - if (r < 0) { - derr << "error retrieving local cluster uuid: " << cpp_strerror(r) - << dendl; - return r; - } - m_client_id = uuid; - // TODO: make interval configurable m_pool_watcher.reset(new PoolWatcher(m_remote, 30, m_lock, m_cond)); m_pool_watcher->refresh_images(); @@ -183,6 +175,14 @@ void Replayer::set_sources(const map > &images) continue; } + std::string mirror_uuid; + r = librbd::cls_client::mirror_uuid_get(&local_ioctx, &mirror_uuid); + if (r < 0) { + derr << "failed to retrieve mirror uuid from pool " + << local_ioctx.get_pool_name() << ": " << cpp_strerror(r) << dendl; + continue; + } + // create entry for pool if it doesn't exist auto &pool_replayers = m_images[pool_id]; for (const auto &image_id : kv.second) { @@ -191,7 +191,7 @@ void Replayer::set_sources(const map > &images) unique_ptr image_replayer(new ImageReplayer(m_threads, m_local, m_remote, - m_client_id, + mirror_uuid, local_ioctx.get_id(), pool_id, image_id)); diff --git a/src/tools/rbd_mirror/Replayer.h b/src/tools/rbd_mirror/Replayer.h index 83748b94e747d..dc566b72cb552 100644 --- a/src/tools/rbd_mirror/Replayer.h +++ b/src/tools/rbd_mirror/Replayer.h @@ -53,7 +53,6 @@ private: peer_t m_peer; std::vector m_args; - std::string m_client_id; RadosRef m_local, m_remote; std::unique_ptr m_pool_watcher; // index by pool so it's easy to tell what is affected -- 2.39.5