]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/tools/rbd_mirror/PoolReplayer.cc
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / tools / rbd_mirror / PoolReplayer.cc
index 7c450379f64859858e9848677824b0a10e703e80..ac3463256704a9f95fa67ac953b53fb9a5823f8d 100644 (file)
@@ -272,6 +272,8 @@ bool PoolReplayer<I>::is_running() const {
 template <typename I>
 void PoolReplayer<I>::init()
 {
+  Mutex::Locker l(m_lock);
+
   ceph_assert(!m_pool_replayer_thread.is_started());
 
   // reset state
@@ -414,8 +416,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 +518,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();
@@ -564,6 +566,19 @@ void PoolReplayer<I>::run()
   m_instance_replayer->stop();
 }
 
+template <typename I>
+void PoolReplayer<I>::reopen_logs()
+{
+  Mutex::Locker l(m_lock);
+
+  if (m_local_rados) {
+    reinterpret_cast<CephContext *>(m_local_rados->cct())->reopen_logs();
+  }
+  if (m_remote_rados) {
+    reinterpret_cast<CephContext *>(m_remote_rados->cct())->reopen_logs();
+  }
+}
+
 template <typename I>
 void PoolReplayer<I>::print_status(Formatter *f, stringstream *ss)
 {