]> git-server-git.apps.pok.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>
Fri, 10 Jan 2020 11:51:07 +0000 (11:51 +0000)
We rely on that if a rados ref is initialized it contains the
valid context.

Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit f3b49191771d2a3a20a7f55a14e0a7482ee96172)

src/tools/rbd_mirror/PoolReplayer.cc

index 7c450379f64859858e9848677824b0a10e703e80..ecf406ec277835ce466f5390bbddabf2f184796d 100644 (file)
@@ -414,8 +414,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
@@ -518,6 +516,8 @@ int PoolReplayer<I>::init_rados(const std::string &cluster_name,
   cct->_conf.apply_changes(nullptr);
   cct->_conf.complain_about_parse_errors(cct);
 
+  rados_ref->reset(new librados::Rados());
+
   r = (*rados_ref)->init_with_context(cct);
   ceph_assert(r == 0);
   cct->put();