]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: allow passing fs name to mount()
authorJohn Spray <john.spray@redhat.com>
Wed, 8 Aug 2018 17:32:17 +0000 (13:32 -0400)
committerJohn Spray <john.spray@redhat.com>
Mon, 17 Sep 2018 07:55:20 +0000 (03:55 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/client/Client.cc
src/client/Client.h

index a6e304e33022c4171294bc9c9e74ef70f203e47e..d8264ebaf9c6cb002de29f94d89ce2ef3e07f058 100644 (file)
@@ -5710,7 +5710,7 @@ void Client::handle_command_reply(MCommandReply *m)
 // MOUNT
 
 int Client::mount(const std::string &mount_root, const UserPerm& perms,
-                 bool require_mds)
+                 bool require_mds, const std::string &fs_name)
 {
   Mutex::Locker lock(client_lock);
 
@@ -5727,15 +5727,22 @@ int Client::mount(const std::string &mount_root, const UserPerm& perms,
     return r;
   }
 
+  std::string resolved_fs_name;
+  if (fs_name.empty()) {
+    resolved_fs_name = cct->_conf.get_val<std::string>("client_mds_namespace");
+  } else {
+    resolved_fs_name = fs_name;
+  }
+
   std::string want = "mdsmap";
-  const auto &mds_ns = cct->_conf->client_mds_namespace;
-  if (!mds_ns.empty()) {
+  if (!resolved_fs_name.empty()) {
     r = fetch_fsmap(true);
     if (r < 0)
       return r;
-    fs_cluster_id_t cid = fsmap_user->get_fs_cid(mds_ns);
-    if (cid == FS_CLUSTER_ID_NONE)
+    fs_cluster_id_t cid = fsmap_user->get_fs_cid(resolved_fs_name);
+    if (cid == FS_CLUSTER_ID_NONE) {
       return -ENOENT;
+    }
 
     std::ostringstream oss;
     oss << want << "." << cid;
index 896bde0e6ba1fa2cb98663fb5faa4947e71992fc..50db698dbbc5862dda143f317401579e74e9cef6 100644 (file)
@@ -292,7 +292,7 @@ public:
   }
 
   int mount(const std::string &mount_root, const UserPerm& perms,
-           bool require_mds=false);
+           bool require_mds=false, const std::string &fs_name="");
   void unmount();
   void abort_conn();