mgr/volumes: set the 'bulk' flag for data pools created automatically for a new volume

Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
Fixes: https://tracker.ceph.com/issues/61595
This commit is contained in:
Leonid Usov 2023-08-03 19:41:12 +03:00
parent 4b912b79c9
commit 9a8219cc2b
3 changed files with 21 additions and 6 deletions

View File

@ -442,9 +442,21 @@ class TestVolumes(TestVolumesHelper):
if not (volname in ([volume['name'] for volume in volumels])):
raise RuntimeError("Error creating volume '{0}'".format(volname))
else:
# clean up
self._fs_cmd("volume", "rm", volname, "--yes-i-really-mean-it")
# check that the pools were created with the correct config
pool_details = json.loads(self._raw_cmd("osd", "pool", "ls", "detail", "--format=json"))
pool_flags = {}
for pool in pool_details:
pool_flags[pool["pool_id"]] = pool["flags_names"].split(",")
volume_details = json.loads(self._fs_cmd("get", volname, "--format=json"))
for data_pool_id in volume_details['mdsmap']['data_pools']:
self.assertIn("bulk", pool_flags[data_pool_id])
meta_pool_id = volume_details['mdsmap']['metadata_pool']
self.assertNotIn("bulk", pool_flags[meta_pool_id])
# clean up
self._fs_cmd("volume", "rm", volname, "--yes-i-really-mean-it")
def test_volume_ls(self):
"""

View File

@ -11,9 +11,10 @@ from .exception import VolumeException
log = logging.getLogger(__name__)
def create_pool(mgr, pool_name):
def create_pool(mgr, pool_name, **extra_args):
# create the given pool
command = {'prefix': 'osd pool create', 'pool': pool_name}
command = extra_args
command.update({'prefix': 'osd pool create', 'pool': pool_name})
return mgr.mon_command(command)
def remove_pool(mgr, pool_name):

View File

@ -80,7 +80,9 @@ def create_volume(mgr, volname, placement):
r, outb, outs = create_pool(mgr, metadata_pool)
if r != 0:
return r, outb, outs
r, outb, outs = create_pool(mgr, data_pool)
# default to a bulk pool for data. In case autoscaling has been disabled
# for the cluster with `ceph osd pool set noautoscale`, this will have no effect.
r, outb, outs = create_pool(mgr, data_pool, bulk=True)
if r != 0:
#cleanup
remove_pool(mgr, metadata_pool)