From: Ramana Raja Date: Thu, 14 May 2020 10:06:22 +0000 (+0530) Subject: cephfs: allow pool names with '-' and '.' X-Git-Tag: v17.0.0~2292^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d9f8f8e3d073de8e1cfd5075159420ca8dfdcf2d;p=ceph.git cephfs: allow pool names with '-' and '.' ... to be set as pool layouts for files and directories. Fixes: https://tracker.ceph.com/issues/45521 Signed-off-by: Ramana Raja --- diff --git a/doc/cephfs/administration.rst b/doc/cephfs/administration.rst index 74e73b698e125..605864431c270 100644 --- a/doc/cephfs/administration.rst +++ b/doc/cephfs/administration.rst @@ -6,6 +6,9 @@ CephFS Administrative commands File Systems ------------ +.. note:: The names of the file systems, metadata pools, and data pools can + only have characters in the set [a-zA-Z0-9\_-.]. + These commands operate on the CephFS file systems in your Ceph cluster. Note that by default only one file system is permitted: to enable creation of multiple file systems use ``ceph fs flag set enable_multiple true``. diff --git a/doc/cephfs/createfs.rst b/doc/cephfs/createfs.rst index b5246d8eb33d0..7c0e35cf63d21 100644 --- a/doc/cephfs/createfs.rst +++ b/doc/cephfs/createfs.rst @@ -35,6 +35,8 @@ Generally, the metadata pool will have at most a few gigabytes of data. For this reason, a smaller PG count is usually recommended. 64 or 128 is commonly used in practice for large clusters. +.. note:: The names of the file systems, metadata pools, and data pools can + only have characters in the set [a-zA-Z0-9\_-.]. Creating a file system ====================== diff --git a/doc/cephfs/file-layouts.rst b/doc/cephfs/file-layouts.rst index b779b16d207ab..6ff834b083f49 100644 --- a/doc/cephfs/file-layouts.rst +++ b/doc/cephfs/file-layouts.rst @@ -20,10 +20,10 @@ Layout fields ------------- pool - String, giving ID or name. Which RADOS pool a file's data objects will be stored in. + String, giving ID or name. String can only have characters in the set [a-zA-Z0-9\_-.]. Which RADOS pool a file's data objects will be stored in. pool_namespace - String. Within the data pool, which RADOS namespace the objects will + String with only characters in the set [a-zA-Z0-9\_-.]. Within the data pool, which RADOS namespace the objects will be written to. Empty by default (i.e. default namespace). stripe_unit diff --git a/qa/tasks/cephfs/test_admin.py b/qa/tasks/cephfs/test_admin.py index 140e5de15f6b6..7ff6ed536b9ab 100644 --- a/qa/tasks/cephfs/test_admin.py +++ b/qa/tasks/cephfs/test_admin.py @@ -74,6 +74,14 @@ class TestAdminCommands(CephFSTestCase): self.mount_a.run_shell("mkdir subdir") self.fs.set_dir_layout(self.mount_a, "subdir", FileLayout(pool=p)) + def test_add_data_pool_non_alphamueric_name_as_subdir(self): + """ + That a new data pool with non-alphanumeric name can be added and used for a sub-directory. + """ + p = self.fs.add_data_pool("I-am-data_pool00.") + self.mount_a.run_shell("mkdir subdir") + self.fs.set_dir_layout(self.mount_a, "subdir", FileLayout(pool=p)) + def test_add_data_pool_ec(self): """ That a new EC data pool can be added. diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 3f46860e78b56..403132f0a30aa 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -1856,7 +1856,7 @@ struct keys_and_values query = pair >> *(qi::lit(' ') >> pair); pair = key >> '=' >> value; key = qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9"); - value = +qi::char_("a-zA-Z_0-9"); + value = +qi::char_("a-zA-Z0-9-_."); } qi::rule()> query; qi::rule()> pair;