From 9f97401f2794d51cfd7c44564a82b747e88420f9 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Thu, 23 Apr 2020 19:10:48 +0530 Subject: [PATCH] mgr/volumes: Add nfs cluster update interface $ ceph nfs cluster update This updates the existing deployed cluster according to placement value. Signed-off-by: Varsha Rao --- doc/cephfs/fs-nfs-exports.rst | 9 +++++++++ src/pybind/mgr/volumes/fs/nfs.py | 8 ++++++-- src/pybind/mgr/volumes/module.py | 10 ++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/doc/cephfs/fs-nfs-exports.rst b/doc/cephfs/fs-nfs-exports.rst index b076b88280c6e..e92935223b9d8 100644 --- a/doc/cephfs/fs-nfs-exports.rst +++ b/doc/cephfs/fs-nfs-exports.rst @@ -27,6 +27,15 @@ For more details on placement specification refer the `orchestrator doc `_. Currently only CephFS export type is supported. +Update NFS Ganesha Cluster +========================== + +.. code:: bash + + $ ceph nfs cluster update + +This updates the deployed cluster according to the placement value. + Create CephFS Export ==================== diff --git a/src/pybind/mgr/volumes/fs/nfs.py b/src/pybind/mgr/volumes/fs/nfs.py index f7084b0d99b71..d136362f96563 100644 --- a/src/pybind/mgr/volumes/fs/nfs.py +++ b/src/pybind/mgr/volumes/fs/nfs.py @@ -388,8 +388,12 @@ class NFSCluster: return 0, "", "NFS Cluster Created Successfully" - def update_nfs_cluster(self, size): - raise NotImplementedError() + def update_nfs_cluster(self, placement): + if not self.check_cluster_exists(): + return -errno.EINVAL, "", "Cluster does not exist" + + self._call_orch_apply_nfs(placement) + return 0, "", "NFS Cluster Updated Successfully" def delete_nfs_cluster(self): raise NotImplementedError() diff --git a/src/pybind/mgr/volumes/module.py b/src/pybind/mgr/volumes/module.py index 23095f85bd4ce..bae930dc91044 100644 --- a/src/pybind/mgr/volumes/module.py +++ b/src/pybind/mgr/volumes/module.py @@ -247,6 +247,13 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): 'desc': "Create an NFS Cluster", 'perm': 'rw' }, + { + 'cmd': 'nfs cluster update ' + 'name=clusterid,type=CephString ' + 'name=placement,type=CephString ', + 'desc': "Updates an NFS Cluster", + 'perm': 'rw' + }, # volume ls [recursive] # subvolume ls # volume authorize/deauthorize @@ -430,3 +437,6 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): nfs_cluster_obj = NFSCluster(self, cmd['clusterid']) return nfs_cluster_obj.create_nfs_cluster(export_type=cmd['type'], placement=cmd.get('placement', None)) + def _cmd_nfs_cluster_update(self, inbuf, cmd): + nfs_cluster_obj = NFSCluster(self, cmd['clusterid']) + return nfs_cluster_obj.update_nfs_cluster(placement=cmd['placement']) -- 2.39.5