]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: rbd-mirroring: Replayer registers in remote journal with mirror_uuid 8280/head
authorRicardo Dias <rdias@suse.com>
Wed, 23 Mar 2016 17:06:46 +0000 (17:06 +0000)
committerRicardo Dias <rdias@suse.com>
Wed, 23 Mar 2016 22:12:37 +0000 (22:12 +0000)
Signed-off-by: Ricardo Dias <rdias@suse.com>
Fixes: #15238
src/tools/rbd_mirror/Replayer.cc
src/tools/rbd_mirror/Replayer.h

index 620a6a848ef554bf1551df29409ed6d9a7eab809..d3c914d9f851b9fc5c13a9d93c52166af1e5533d 100644 (file)
@@ -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<int64_t, set<string> > &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<int64_t, set<string> > &images)
        unique_ptr<ImageReplayer> image_replayer(new ImageReplayer(m_threads,
                                                                   m_local,
                                                                   m_remote,
-                                                                  m_client_id,
+                                                                  mirror_uuid,
                                                                   local_ioctx.get_id(),
                                                                   pool_id,
                                                                   image_id));
index 83748b94e747da5de2e8b235368b2580db222c32..dc566b72cb552c8fcda5869d4f219f134a55414b 100644 (file)
@@ -53,7 +53,6 @@ private:
 
   peer_t m_peer;
   std::vector<const char*> m_args;
-  std::string m_client_id;
   RadosRef m_local, m_remote;
   std::unique_ptr<PoolWatcher> m_pool_watcher;
   // index by pool so it's easy to tell what is affected