From 24b70c51862c02c3a8ba3d177317c70072867f23 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Tue, 8 Dec 2020 23:46:27 +0530 Subject: [PATCH] mgr/volumes/nfs: remove 'ganesha-' prefix from cluster id Orchestrator defines service name as ".". The ganesha common config object name in orchestrator is "conf-". Volume's nfs plugin deploys nfs-ganesha clusters with 'ganesha' prefixed to cluster id and common config object. It can cause unecessary issues in rook and cephadm. So let's remove the prefix. Fixes: https://tracker.ceph.com/issues/48514 Signed-off-by: Varsha Rao --- qa/tasks/cephfs/test_nfs.py | 6 +++--- src/pybind/mgr/volumes/fs/nfs.py | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 4a7f1e81109..ca2b86a017f 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -36,7 +36,7 @@ class TestNFS(MgrTestCase): self.pseudo_path = "/cephfs" self.path = "/" self.fs_name = "nfs-cephfs" - self.expected_name = "nfs.ganesha-test" + self.expected_name = "nfs.test" self.sample_export = { "export_id": 1, "path": self.path, @@ -119,7 +119,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) - # Check for expected status and daemon name (nfs.ganesha-) + # Check for expected status and daemon name (nfs.) self._check_nfs_cluster_status('running', 'NFS Ganesha cluster deployment failed') def _test_delete_cluster(self): @@ -496,7 +496,7 @@ class TestNFS(MgrTestCase): 'set', self.cluster_id, '-i', '-'], stdin=config) time.sleep(30) res = self._sys_cmd(['rados', '-p', pool, '-N', self.cluster_id, 'get', - f'userconf-nfs.ganesha-{user_id}', '-']) + f'userconf-nfs.{user_id}', '-']) self.assertEqual(config, res.decode('utf-8')) self._test_mnt(pseudo_path, port, ip) self._nfs_cmd('cluster', 'config', 'reset', self.cluster_id) diff --git a/src/pybind/mgr/volumes/fs/nfs.py b/src/pybind/mgr/volumes/fs/nfs.py index b18c90d42bb..a6f21c137e4 100644 --- a/src/pybind/mgr/volumes/fs/nfs.py +++ b/src/pybind/mgr/volumes/fs/nfs.py @@ -19,17 +19,17 @@ POOL_NAME = 'nfs-ganesha' def available_clusters(mgr): ''' This method returns list of available cluster ids. - It removes 'ganesha-' prefixes from cluster service id returned by cephadm. + Service name is service_type.service_id Example: completion.result value: - > - return value: ['ganesha-vstart'] -> ['vstart'] + > + return value: ['vstart'] ''' # TODO check cephadm cluster list with rados pool conf objects completion = mgr.describe_service(service_type='nfs') mgr._orchestrator_wait([completion]) orchestrator.raise_if_exception(completion) - return [cluster.spec.service_id.replace('ganesha-', '', 1) for cluster in completion.result + return [cluster.spec.service_id for cluster in completion.result if cluster.spec.service_id] @@ -513,7 +513,7 @@ class FSExport(object): def _save_export(self, export): self.exports[self.rados_namespace].append(export) NFSRados(self.mgr, self.rados_namespace).write_obj(export.to_export_block(), - f'export-{export.export_id}', f'conf-nfs.ganesha-{export.cluster_id}') + f'export-{export.export_id}', f'conf-nfs.{export.cluster_id}') def _delete_export(self, cluster_id, pseudo_path, export_obj=None): try: @@ -525,7 +525,7 @@ class FSExport(object): if export: if pseudo_path: NFSRados(self.mgr, self.rados_namespace).remove_obj( - f'export-{export.export_id}', f'conf-nfs.ganesha-{cluster_id}') + f'export-{export.export_id}', f'conf-nfs.{cluster_id}') self.exports[cluster_id].remove(export) self._delete_user(export.fsal.user_id) if not self.exports[cluster_id]: @@ -646,7 +646,7 @@ class NFSCluster: self.mgr = mgr def _set_cluster_id(self, cluster_id): - self.cluster_id = f"ganesha-{cluster_id}" + self.cluster_id = cluster_id def _set_pool_namespace(self, cluster_id): self.pool_ns = cluster_id -- 2.39.5