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 <rraja@redhat.com>
This commit is contained in:
Ramana Raja 2020-05-14 15:36:22 +05:30
parent 2941bbd7bc
commit d9f8f8e3d0
5 changed files with 16 additions and 3 deletions

View File

@ -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``.

View File

@ -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
======================

View File

@ -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

View File

@ -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.

View File

@ -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<Iterator, std::map<std::string, std::string>()> query;
qi::rule<Iterator, std::pair<std::string, std::string>()> pair;