From: Sage Weil Date: Wed, 26 May 2021 20:18:44 +0000 (-0400) Subject: mgr/nfs: name nfs cephfs client key 'nfs.{cluster_id}.{export_id}' X-Git-Tag: v17.1.0~1551^2~53 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9b1372dc388e5c783208ecc9251598f0985383a8;p=ceph-ci.git mgr/nfs: name nfs cephfs client key 'nfs.{cluster_id}.{export_id}' Better than '{cluster_id}{export_id}', which is confusing and ambiguous. Signed-off-by: Sage Weil --- diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 1e453ba1337..0ba781c2e79 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -54,7 +54,7 @@ class TestNFS(MgrTestCase): ], "fsal": { "name": "CEPH", - "user_id": "test1", + "user_id": "nfs.test.1", "fs_name": self.fs_name, "sec_label_xattr": '' }, @@ -96,9 +96,9 @@ class TestNFS(MgrTestCase): ''' output = self._cmd('auth', 'ls') if check_in: - self.assertIn(f'client.{self.cluster_id}{export_id}', output) + self.assertIn(f'client.nfs.{self.cluster_id}.{export_id}', output) else: - self.assertNotIn(f'client-{self.cluster_id}', output) + self.assertNotIn(f'client.nfs.{self.cluster_id}.{export_id}', output) def _test_idempotency(self, cmd_func, cmd_args): ''' @@ -201,19 +201,19 @@ class TestNFS(MgrTestCase): self.sample_export['export_id'] = 2 self.sample_export['pseudo'] = self.pseudo_path + '1' self.sample_export['access_type'] = 'RO' - self.sample_export['fsal']['user_id'] = self.cluster_id + '2' + self.sample_export['fsal']['user_id'] = f'nfs.{self.cluster_id}.2' self.assertDictEqual(self.sample_export, nfs_output[1]) # Export-3 for subvolume with r only self.sample_export['export_id'] = 3 self.sample_export['path'] = sub_vol_path self.sample_export['pseudo'] = self.pseudo_path + '2' - self.sample_export['fsal']['user_id'] = self.cluster_id + '3' + self.sample_export['fsal']['user_id'] = f'nfs.{self.cluster_id}.3' self.assertDictEqual(self.sample_export, nfs_output[2]) # Export-4 for subvolume self.sample_export['export_id'] = 4 self.sample_export['pseudo'] = self.pseudo_path + '3' self.sample_export['access_type'] = 'RW' - self.sample_export['fsal']['user_id'] = self.cluster_id + '4' + self.sample_export['fsal']['user_id'] = f'nfs.{self.cluster_id}.4' self.assertDictEqual(self.sample_export, nfs_output[3]) def _get_export(self): diff --git a/src/pybind/mgr/nfs/export.py b/src/pybind/mgr/nfs/export.py index 4469389ab61..84d46738112 100644 --- a/src/pybind/mgr/nfs/export.py +++ b/src/pybind/mgr/nfs/export.py @@ -443,7 +443,7 @@ class FSExport(ExportMgr): if not self._fetch_export(pseudo_path): ex_id = self._gen_export_id() - user_id = f"{cluster_id}{ex_id}" + user_id = f"nfs.{cluster_id}.{ex_id}" user_out, key = self._create_user_key(user_id, path, fs_name, read_only) if clients: access_type = "none"