]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: delay local/remote rados initialization until context created
authorMykola Golub <mgolub@suse.com>
Sun, 5 Jan 2020 09:10:24 +0000 (09:10 +0000)
committerMykola Golub <mgolub@suse.com>
Sun, 5 Jan 2020 09:12:21 +0000 (09:12 +0000)
We rely on that if a rados ref is initialized it contains the
valid context.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/tools/rbd_mirror/PoolReplayer.cc

index 5e822e84213226547eb96ad5a6af3c661c273678..0447289797fe6d607f9256a1b840dbdf2557f137 100644 (file)
@@ -398,8 +398,6 @@ int PoolReplayer<I>::init_rados(const std::string &cluster_name,
                                const std::string &description,
                                RadosRef *rados_ref,
                                 bool strip_cluster_overrides) {
-  rados_ref->reset(new librados::Rados());
-
   // NOTE: manually bootstrap a CephContext here instead of via
   // the librados API to avoid mixing global singletons between
   // the librados shared library and the daemon
@@ -502,6 +500,8 @@ int PoolReplayer<I>::init_rados(const std::string &cluster_name,
   cct->_conf.apply_changes(nullptr);
   cct->_conf.complain_about_parse_error(cct);
 
+  rados_ref->reset(new librados::Rados());
+
   r = (*rados_ref)->init_with_context(cct);
   ceph_assert(r == 0);
   cct->put();