From 87a6d6a58f8fe832dc3800131fb2af1a84bd8d14 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Sun, 5 Jan 2020 09:10:24 +0000 Subject: [PATCH] rbd-mirror: delay local/remote rados initialization until context created We rely on that if a rados ref is initialized it contains the valid context. Signed-off-by: Mykola Golub (cherry picked from commit f3b49191771d2a3a20a7f55a14e0a7482ee96172) Conflicts: src/tools/rbd_mirror/PoolReplayer.cc (trivial) --- src/tools/rbd_mirror/PoolReplayer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/rbd_mirror/PoolReplayer.cc b/src/tools/rbd_mirror/PoolReplayer.cc index 1edd145b332d0..f48c1bc913b2a 100644 --- a/src/tools/rbd_mirror/PoolReplayer.cc +++ b/src/tools/rbd_mirror/PoolReplayer.cc @@ -383,8 +383,6 @@ int PoolReplayer::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 @@ -468,6 +466,8 @@ int PoolReplayer::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); assert(r == 0); cct->put(); -- 2.39.5