From: Daniel-Pivonka Date: Thu, 13 Feb 2020 18:56:13 +0000 (-0500) Subject: mgr/volumes: add arg to fs volume create for mds daemons placement X-Git-Tag: v15.1.1~337^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2fe4f88ba021ae29835949b05d47e27e548cf4df;p=ceph-ci.git mgr/volumes: add arg to fs volume create for mds daemons placement add placement arg for mds daemons created by fs volume create Signed-off-by: Daniel-Pivonka --- diff --git a/doc/cephfs/fs-volumes.rst b/doc/cephfs/fs-volumes.rst index 18404ecc80b..6cd5e7c15dd 100644 --- a/doc/cephfs/fs-volumes.rst +++ b/doc/cephfs/fs-volumes.rst @@ -43,7 +43,7 @@ FS Volumes Create a volume using:: - $ ceph fs volume create + $ ceph fs volume create [] This creates a CephFS file system and its data and metadata pools. It also tries to create MDSes for the filesystem using the enabled ceph-mgr orchestrator diff --git a/src/pybind/mgr/volumes/fs/fs_util.py b/src/pybind/mgr/volumes/fs/fs_util.py index bf3fd751864..c0e7e338aed 100644 --- a/src/pybind/mgr/volumes/fs/fs_util.py +++ b/src/pybind/mgr/volumes/fs/fs_util.py @@ -33,8 +33,8 @@ def remove_filesystem(mgr, fs_name): command = {'prefix': 'fs rm', 'fs_name': fs_name, 'yes_i_really_mean_it': True} return mgr.mon_command(command) -def create_mds(mgr, fs_name): - spec = orchestrator.ServiceSpec(fs_name) +def create_mds(mgr, fs_name, placement): + spec = orchestrator.ServiceSpec(fs_name, orchestrator.PlacementSpec.from_strings(placement.split())) try: completion = mgr.apply_mds(spec) mgr._orchestrator_wait([completion]) diff --git a/src/pybind/mgr/volumes/fs/operations/volume.py b/src/pybind/mgr/volumes/fs/operations/volume.py index 7e6bf2b15a5..d3b295ba5db 100644 --- a/src/pybind/mgr/volumes/fs/operations/volume.py +++ b/src/pybind/mgr/volumes/fs/operations/volume.py @@ -197,7 +197,7 @@ def gen_pool_names(volname): """ return "cephfs.{}.meta".format(volname), "cephfs.{}.data".format(volname) -def create_volume(mgr, volname): +def create_volume(mgr, volname, placement): """ create volume (pool, filesystem and mds) """ @@ -220,7 +220,7 @@ def create_volume(mgr, volname): remove_pool(metadata_pool) return r, outb, outs # create mds - return create_mds(mgr, volname) + return create_mds(mgr, volname, placement) def delete_volume(mgr, volname): """ diff --git a/src/pybind/mgr/volumes/fs/volume.py b/src/pybind/mgr/volumes/fs/volume.py index a10488d1292..798f1f07b9a 100644 --- a/src/pybind/mgr/volumes/fs/volume.py +++ b/src/pybind/mgr/volumes/fs/volume.py @@ -83,10 +83,10 @@ class VolumeClient(object): ### volume operations -- create, rm, ls - def create_fs_volume(self, volname): + def create_fs_volume(self, volname, placement): if self.is_stopping(): return -errno.ESHUTDOWN, "", "shutdown in progress" - return create_volume(self.mgr, volname) + return create_volume(self.mgr, volname, placement) def delete_fs_volume(self, volname, confirm): if self.is_stopping(): diff --git a/src/pybind/mgr/volumes/module.py b/src/pybind/mgr/volumes/module.py index bbde5008013..ae3033b7bc6 100644 --- a/src/pybind/mgr/volumes/module.py +++ b/src/pybind/mgr/volumes/module.py @@ -15,7 +15,8 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): }, { 'cmd': 'fs volume create ' - 'name=name,type=CephString ', + 'name=name,type=CephString ' + 'name=placement,type=CephString,req=false ', 'desc': "Create a CephFS volume", 'perm': 'rw' }, @@ -242,7 +243,8 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): def _cmd_fs_volume_create(self, inbuf, cmd): vol_id = cmd['name'] - return self.vc.create_fs_volume(vol_id) + placement = cmd.get('placement', None) + return self.vc.create_fs_volume(vol_id, placement) def _cmd_fs_volume_rm(self, inbuf, cmd): vol_name = cmd['vol_name']