From: Michael Fritch Date: Thu, 15 Apr 2021 00:21:36 +0000 (-0600) Subject: mgr/volumes/nfs: drop `type` param during cluster create X-Git-Tag: v17.1.0~2227^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e9b2c38354c0b6f5729ef656ce299501b3252496;p=ceph.git mgr/volumes/nfs: drop `type` param during cluster create PR #37600 introduced support for both `cephfs` and `rgw` exports to be configured using a single nfs-ganesha cluster Fixes: https://tracker.ceph.com/issues/50369 Signed-off-by: Michael Fritch --- diff --git a/doc/cephfs/fs-nfs-exports.rst b/doc/cephfs/fs-nfs-exports.rst index 282a5e2842d..d7be0edf1dd 100644 --- a/doc/cephfs/fs-nfs-exports.rst +++ b/doc/cephfs/fs-nfs-exports.rst @@ -16,7 +16,7 @@ Create NFS Ganesha Cluster .. code:: bash - $ ceph nfs cluster create [] + $ ceph nfs cluster create [] This creates a common recovery pool for all NFS Ganesha daemons, new user based on ``clusterid``, and a common NFS Ganesha config RADOS object. @@ -28,10 +28,6 @@ This creates a common recovery pool for all NFS Ganesha daemons, new user based Currently, NFS Ganesha daemon deployed by cephadm listens on the standard port. So only one daemon will be deployed on a host. -```` signifies the export type, which corresponds to the NFS Ganesha file -system abstraction layer (FSAL). Permissible values are ``"cephfs`` or -``rgw``, but currently only ``cephfs`` is supported. - ```` is an arbitrary string by which this NFS Ganesha cluster will be known. diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 30d9d6df47b..77548965d4e 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -118,7 +118,7 @@ class TestNFS(MgrTestCase): ''' # Disable any running nfs ganesha daemon self._check_nfs_server_status() - self._nfs_cmd('cluster', 'create', self.export_type, self.cluster_id) + self._nfs_cmd('cluster', 'create', self.cluster_id) # Check for expected status and daemon name (nfs.) self._check_nfs_cluster_status('running', 'NFS Ganesha cluster deployment failed') @@ -295,8 +295,7 @@ class TestNFS(MgrTestCase): ''' Test idempotency of cluster create and delete commands. ''' - self._test_idempotency(self._test_create_cluster, ['nfs', 'cluster', 'create', self.export_type, - self.cluster_id]) + self._test_idempotency(self._test_create_cluster, ['nfs', 'cluster', 'create', self.cluster_id]) self._test_idempotency(self._test_delete_cluster, ['nfs', 'cluster', 'delete', self.cluster_id]) def test_create_cluster_with_invalid_cluster_id(self): @@ -305,26 +304,13 @@ class TestNFS(MgrTestCase): ''' try: invalid_cluster_id = '/cluster_test' # Only [A-Za-z0-9-_.] chars are valid - self._nfs_cmd('cluster', 'create', self.export_type, invalid_cluster_id) + self._nfs_cmd('cluster', 'create', invalid_cluster_id) self.fail(f"Cluster successfully created with invalid cluster id {invalid_cluster_id}") except CommandFailedError as e: # Command should fail for test to pass if e.exitstatus != errno.EINVAL: raise - def test_create_cluster_with_invalid_export_type(self): - ''' - Test nfs cluster deployment failure with invalid export type. - ''' - try: - invalid_export_type = 'rgw' # Only cephfs is valid - self._nfs_cmd('cluster', 'create', invalid_export_type, self.cluster_id) - self.fail(f"Cluster successfully created with invalid export type {invalid_export_type}") - except CommandFailedError as e: - # Command should fail for test to pass - if e.exitstatus != errno.EINVAL: - raise - def test_create_and_delete_export(self): ''' Test successful creation and deletion of the cephfs export. diff --git a/src/pybind/mgr/volumes/fs/nfs.py b/src/pybind/mgr/volumes/fs/nfs.py index f5e713d79cf..6b52cddb273 100644 --- a/src/pybind/mgr/volumes/fs/nfs.py +++ b/src/pybind/mgr/volumes/fs/nfs.py @@ -869,9 +869,7 @@ class NFSCluster: f"{self.pool_ns}") @cluster_setter - def create_nfs_cluster(self, export_type, cluster_id, placement): - if export_type != 'cephfs': - return -errno.EINVAL, "", f"Invalid export type: {export_type}" + def create_nfs_cluster(self, cluster_id, placement): try: pool_list = [p['pool_name'] for p in self.mgr.get_osdmap().dump().get('pools', [])] diff --git a/src/pybind/mgr/volumes/module.py b/src/pybind/mgr/volumes/module.py index b2acbbdeb46..030a9f8f4cf 100644 --- a/src/pybind/mgr/volumes/module.py +++ b/src/pybind/mgr/volumes/module.py @@ -359,7 +359,6 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): }, { 'cmd': 'nfs cluster create ' - 'name=type,type=CephString ' f'name=clusterid,type=CephString,goodchars={goodchars} ' 'name=placement,type=CephString,req=false ', 'desc': "Create an NFS Cluster", @@ -717,7 +716,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): @mgr_cmd_wrap def _cmd_nfs_cluster_create(self, inbuf, cmd): - return self.nfs.create_nfs_cluster(cluster_id=cmd['clusterid'], export_type=cmd['type'], + return self.nfs.create_nfs_cluster(cluster_id=cmd['clusterid'], placement=cmd.get('placement', None)) @mgr_cmd_wrap diff --git a/src/vstart.sh b/src/vstart.sh index 4037cf1829b..7c9d744c503 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -1140,7 +1140,7 @@ start_ganesha() { ceph_adm mgr module enable test_orchestrator ceph_adm orch set backend test_orchestrator ceph_adm test_orchestrator load_data -i $CEPH_ROOT/src/pybind/mgr/test_orchestrator/dummy_data.json - prun ceph_adm nfs cluster create cephfs $cluster_id + prun ceph_adm nfs cluster create $cluster_id prun ceph_adm nfs export create cephfs "a" $cluster_id "/cephfs" for name in a b c d e f g h i j k l m n o p @@ -1427,7 +1427,7 @@ if [ $GANESHA_DAEMON_NUM -gt 0 ]; then pseudo_path="/cephfs" if [ "$cephadm" -gt 0 ]; then cluster_id="vstart" - prun ceph_adm nfs cluster create cephfs $cluster_id + prun ceph_adm nfs cluster create $cluster_id prun ceph_adm nfs export create cephfs "a" $cluster_id $pseudo_path port="2049" else