From: John Spray Date: Wed, 8 Aug 2018 17:32:17 +0000 (-0400) Subject: client: allow passing fs name to mount() X-Git-Tag: v14.0.1~194^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=eae7e2d3b49e3d13294f512cfe9abf5ce36335a6;p=ceph-ci.git client: allow passing fs name to mount() Signed-off-by: John Spray --- diff --git a/src/client/Client.cc b/src/client/Client.cc index a6e304e3302..d8264ebaf9c 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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("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; diff --git a/src/client/Client.h b/src/client/Client.h index 896bde0e6ba..50db698dbbc 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -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();