Merge PR #33506 into master

* refs/pull/33506/head:
	client: add client_fs mount option support

Reviewed-by: Ramana Raja <rraja@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2020-03-02 16:58:02 -08:00
commit 61681cffd2
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
7 changed files with 20 additions and 12 deletions

View File

@ -55,11 +55,11 @@ root of CephFS on your local FS::
ceph-fuse --id foo -r /path/to/dir /mnt/mycephfs
If you have more than one FS on your Ceph cluster, use the option
``--client_mds_namespace`` to mount the non-default FS::
``--client_fs`` to mount the non-default FS::
ceph-fuse --id foo --client_mds_namespace mycephfs2 /mnt/mycephfs2
ceph-fuse --id foo --client_fs mycephfs2 /mnt/mycephfs2
You may also add a ``client_mds_namespace`` setting to your ``ceph.conf``
You may also add a ``client_fs`` setting to your ``ceph.conf``
Unmounting CephFS
=================

View File

@ -184,9 +184,9 @@ To mount a particular directory within CephFS you can use ``-r``::
sudo ceph-fuse -r {path-to-be-mounted} /mnt/mycephfs
If you have multiple file systems on your cluster you would need to pass
``--client_mds_namespace {fs-name}`` to the ``ceph-fuse`` command::
``--client_fs {fs-name}`` to the ``ceph-fuse`` command::
sudo ceph-fuse /mnt/mycephfs2 --client_mds_namespace mycephfs2
sudo ceph-fuse /mnt/mycephfs2 --client_fs mycephfs2
Refer `ceph-fuse man page`_ and `Mount CephFS using FUSE`_ to read more about
this.

View File

@ -68,7 +68,7 @@ class FuseMount(CephFSMount):
fuse_cmd += ["--client_mountpoint={0}".format(mount_path)]
if mount_fs_name is not None:
fuse_cmd += ["--client_mds_namespace={0}".format(mount_fs_name)]
fuse_cmd += ["--client_fs={0}".format(mount_fs_name)]
fuse_cmd += mount_options

View File

@ -854,7 +854,7 @@ class LocalFuseMount(FuseMount):
prefix += ["--client_mountpoint={0}".format(mount_path)]
if mount_fs_name is not None:
prefix += ["--client_mds_namespace={0}".format(mount_fs_name)]
prefix += ["--client_fs={0}".format(mount_fs_name)]
prefix += mount_options;

View File

@ -5825,7 +5825,10 @@ int Client::subscribe_mdsmap(const std::string &fs_name)
std::string resolved_fs_name;
if (fs_name.empty()) {
resolved_fs_name = cct->_conf.get_val<std::string>("client_mds_namespace");
resolved_fs_name = cct->_conf.get_val<std::string>("client_fs");
if (resolved_fs_name.empty())
// Try the backwards compatibility fs name option
resolved_fs_name = cct->_conf.get_val<std::string>("client_mds_namespace");
} else {
resolved_fs_name = fs_name;
}

View File

@ -8362,9 +8362,9 @@ std::vector<Option> get_mds_client_options() {
.set_default(false)
.set_description(""),
Option("client_mds_namespace", Option::TYPE_STR, Option::LEVEL_ADVANCED)
Option("client_fs", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_flag(Option::FLAG_STARTUP)
.set_default("")
.set_description("CephFS file system name to mount")
.set_long_description("Use this with ceph-fuse, or with any process "
"that uses libcephfs. Programs using libcephfs may also pass "
@ -8372,6 +8372,11 @@ std::vector<Option> get_mds_client_options() {
"If no filesystem name is given in mount() or this setting, the default "
"filesystem will be mounted (usually the first created)."),
/* Alias for client_fs. Deprecated */
Option("client_mds_namespace", Option::TYPE_STR, Option::LEVEL_DEV)
.set_flag(Option::FLAG_STARTUP)
.set_default(""),
Option("fake_statfs_for_testing", Option::TYPE_INT, Option::LEVEL_DEV)
.set_default(0)
.set_description("Set a value for kb and compute kb_used from total of num_bytes"),

View File

@ -257,8 +257,8 @@ int ceph_init(struct ceph_mount_info *cmount);
*
* An error will be returned if this libcephfs instance is already
* mounted. This function is an alternative to setting the global
* client_mds_namespace setting. Using this function enables multiple
* libcephfs instances in the same process to mount different filesystems.
* client_fs setting. Using this function enables multiple libcephfs
* instances in the same process to mount different filesystems.
*
* The filesystem name is *not* validated in this function. That happens
* during mount(), where an ENOENT error will result if a non-existent