From b16190bb5fb61754199cf9731c496888299c983a Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Tue, 21 Apr 2020 18:23:04 +0530 Subject: [PATCH] mgr/volumes: Add placement option to create nfs cluster interface Signed-off-by: Varsha Rao --- doc/cephfs/fs-nfs-exports.rst | 13 +++++-------- src/pybind/mgr/volumes/fs/nfs.py | 8 ++++---- src/pybind/mgr/volumes/module.py | 6 +++--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/doc/cephfs/fs-nfs-exports.rst b/doc/cephfs/fs-nfs-exports.rst index f18bbbae170..b076b88280c 100644 --- a/doc/cephfs/fs-nfs-exports.rst +++ b/doc/cephfs/fs-nfs-exports.rst @@ -17,18 +17,15 @@ Create NFS Ganesha Cluster .. code:: bash - $ ceph nfs cluster create [--size=1] + $ ceph nfs cluster create [] This creates a common recovery pool for all Ganesha daemons, new user based on cluster_id and common ganesha config rados object. -Here size denotes the number of ganesha daemons within a cluster and type is -export type. Currently only CephFS is supported. - -.. note:: This does not setup ganesha recovery database and start the daemons. - It needs to be done manually if not using vstart for creating - clusters. Please refer `ganesha-rados-grace doc - `_ +Here type is export type and placement specifies the size of cluster and hosts. +For more details on placement specification refer the `orchestrator doc +`_. +Currently only CephFS export type is supported. Create CephFS Export ==================== diff --git a/src/pybind/mgr/volumes/fs/nfs.py b/src/pybind/mgr/volumes/fs/nfs.py index d53e00617ee..f7084b0d99b 100644 --- a/src/pybind/mgr/volumes/fs/nfs.py +++ b/src/pybind/mgr/volumes/fs/nfs.py @@ -349,10 +349,10 @@ class NFSCluster: log.exception(str(e)) return True - def _call_orch_apply_nfs(self, size): + def _call_orch_apply_nfs(self, placement): spec = NFSServiceSpec(service_type='nfs', service_id=self.cluster_id, pool=self.pool_name, namespace=self.pool_ns, - placement=PlacementSpec.from_string(str(size))) + placement=PlacementSpec.from_string(placement)) try: completion = self.mgr.apply_nfs(spec) self.mgr._orchestrator_wait([completion]) @@ -360,7 +360,7 @@ class NFSCluster: except Exception as e: log.exception("Failed to create NFS daemons:{}".format(e)) - def create_nfs_cluster(self, export_type, size): + def create_nfs_cluster(self, export_type, placement): if export_type != 'cephfs': return -errno.EINVAL,"", f"Invalid export type: {export_type}" @@ -384,7 +384,7 @@ class NFSCluster: if self.check_cluster_exists(): log.info(f"{self.cluster_id} cluster already exists") else: - self._call_orch_apply_nfs(size) + self._call_orch_apply_nfs(placement) return 0, "", "NFS Cluster Created Successfully" diff --git a/src/pybind/mgr/volumes/module.py b/src/pybind/mgr/volumes/module.py index 49c9c17cd2f..23095f85bd4 100644 --- a/src/pybind/mgr/volumes/module.py +++ b/src/pybind/mgr/volumes/module.py @@ -243,7 +243,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): 'cmd': 'nfs cluster create ' 'name=type,type=CephString ' 'name=clusterid,type=CephString ' - 'name=size,type=CephInt,req=false ', + 'name=placement,type=CephString,req=false ', 'desc': "Create an NFS Cluster", 'perm': 'rw' }, @@ -427,6 +427,6 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): return self.fs_export.delete_export(cmd['export_id']) def _cmd_nfs_cluster_create(self, inbuf, cmd): - #TODO add placement option nfs_cluster_obj = NFSCluster(self, cmd['clusterid']) - return nfs_cluster_obj.create_nfs_cluster(export_type=cmd['type'], size=cmd.get('size', 1)) + return nfs_cluster_obj.create_nfs_cluster(export_type=cmd['type'], + placement=cmd.get('placement', None)) -- 2.39.5