From cd71ffce193b16a5612eefae032e4757ed7d4b08 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Thu, 11 May 2017 12:08:58 +0200 Subject: [PATCH] rbd-mirror: resolve admin socket path names collision If global admin_socket parameter is set, for PoolReplayer admin sockets generate and use unique paths in $run_dir. Provide the socket paths in output of PoolReplayer's "rbd mirror status" admin socket command. A possible use case: 1) run "rbd mirror status $pool_replayer" command using global admin socket (known from configuration) and obtain socket paths for the PoolReplayer local and remote context sockets. 2) Use these paths to run commands provides by the contexts. Fixes: http://tracker.ceph.com/issues/19907 Signed-off-by: Mykola Golub --- src/tools/rbd_mirror/PoolReplayer.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tools/rbd_mirror/PoolReplayer.cc b/src/tools/rbd_mirror/PoolReplayer.cc index 751b46c20565b..0bd06f624ae04 100644 --- a/src/tools/rbd_mirror/PoolReplayer.cc +++ b/src/tools/rbd_mirror/PoolReplayer.cc @@ -387,6 +387,11 @@ int PoolReplayer::init_rados(const std::string &cluster_name, } } + if (!g_ceph_context->_conf->admin_socket.empty()) { + cct->_conf->set_val_or_die("admin_socket", + "$run_dir/$name.$pid.$cluster.$cctid.asok"); + } + // disable unnecessary librbd cache cct->_conf->set_val_or_die("rbd_cache", "false"); cct->_conf->apply_changes(nullptr); @@ -464,6 +469,13 @@ void PoolReplayer::print_status(Formatter *f, stringstream *ss) f->close_section(); } + f->dump_string("local_cluster_admin_socket", + reinterpret_cast(m_local_io_ctx.cct())->_conf-> + admin_socket); + f->dump_string("remote_cluster_admin_socket", + reinterpret_cast(m_remote_io_ctx.cct())->_conf-> + admin_socket); + m_instance_replayer->print_status(f, ss); f->close_section(); -- 2.47.3