]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-mirror: allow connecting to local cluster using mon address 41097/head
authorVenky Shankar <vshankar@redhat.com>
Fri, 30 Apr 2021 04:46:24 +0000 (00:46 -0400)
committerVenky Shankar <vshankar@redhat.com>
Wed, 5 May 2021 12:25:49 +0000 (08:25 -0400)
Fixes: http://tracker.ceph.com/issues/50581
Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/tools/cephfs_mirror/FSMirror.cc
src/tools/cephfs_mirror/Utils.cc
src/tools/cephfs_mirror/Utils.h
src/tools/cephfs_mirror/main.cc

index 47dfe530b57c61e59e79b54aa6ee370e68bec012..d18a1563fbea642e522413431956e5a1d32881fd 100644 (file)
@@ -141,7 +141,7 @@ void FSMirror::init(Context *on_finish) {
 
   std::scoped_lock locker(m_lock);
   int r = connect(g_ceph_context->_conf->name.to_str(),
-                  g_ceph_context->_conf->cluster, &m_cluster);
+                  g_ceph_context->_conf->cluster, &m_cluster, "", "", m_args);
   if (r < 0) {
     m_init_failed = true;
     on_finish->complete(r);
index 617ae5ab4a61e624dcc2e061f2655e814d52305f..6393d1d46ea74a35bb8a4659efdd65fa0c4e94d9 100644 (file)
@@ -18,7 +18,8 @@ namespace cephfs {
 namespace mirror {
 
 int connect(std::string_view client_name, std::string_view cluster_name,
-            RadosRef *cluster, std::string_view mon_host, std::string_view cephx_key) {
+            RadosRef *cluster, std::string_view mon_host, std::string_view cephx_key,
+            std::vector<const char *> args) {
   dout(20) << ": connecting to cluster=" << cluster_name << ", client=" << client_name
            << ", mon_host=" << mon_host << dendl;
 
@@ -40,12 +41,13 @@ int connect(std::string_view client_name, std::string_view cluster_name,
 
   cct->_conf.parse_env(cct->get_module_type());
 
-  std::vector<const char*> args;
-  r = cct->_conf.parse_argv(args);
-  if (r < 0) {
-    derr << ": could not parse environment: " << cpp_strerror(r) << dendl;
-    cct->put();
-    return r;
+  if (!args.empty()) {
+    r = cct->_conf.parse_argv(args);
+    if (r < 0) {
+      derr << ": could not parse command line args: " << cpp_strerror(r) << dendl;
+      cct->put();
+      return r;
+    }
   }
   cct->_conf.parse_env(cct->get_module_type());
 
@@ -66,6 +68,8 @@ int connect(std::string_view client_name, std::string_view cluster_name,
     }
   }
 
+  dout(10) << ": using mon addr=" << cct->_conf.get_val<std::string>("mon_host") << dendl;
+
   cluster->reset(new librados::Rados());
 
   r = (*cluster)->init_with_context(cct);
index 837b834221eaf13436c9b46ce6e439aac13af9a1..76b0c07269ca5a61d4f76fcc3d3dc2da60832647 100644 (file)
@@ -10,7 +10,8 @@ namespace cephfs {
 namespace mirror {
 
 int connect(std::string_view client_name, std::string_view cluster_name,
-            RadosRef *cluster, std::string_view mon_host={}, std::string_view cephx_key={});
+            RadosRef *cluster, std::string_view mon_host={}, std::string_view cephx_key={},
+            std::vector<const char *> args={});
 
 int mount(RadosRef cluster, const Filesystem &filesystem, bool cross_check_fscid,
           MountRef *mount);
index aceb57bdbb5e418a0b660d2af30b67e98de04aed..f23e1992456402cad02e8e5b2f16c0efa697c569 100644 (file)
@@ -18,7 +18,9 @@
 void usage() {
   std::cout << "usage: cephfs-mirror [options...]" << std::endl;
   std::cout << "options:\n";
-  std::cout << "  --log-file=<logfile>  file to log debug output\n";
+  std::cout << "  --mon-host monaddress[:port]  connect to specified monitor\n";
+  std::cout << "  --keyring=<path>              path to keyring for local cluster\n";
+  std::cout << "  --log-file=<logfile>          file to log debug output\n";
   std::cout << "  --debug-cephfs-mirror=<log-level>/<memory-level>  set cephfs-mirror debug level\n";
   generic_server_usage();
 }