]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: name nfs cephfs client key 'nfs.{cluster_id}.{export_id}'
authorSage Weil <sage@newdream.net>
Wed, 26 May 2021 20:18:44 +0000 (16:18 -0400)
committerSage Weil <sage@newdream.net>
Thu, 17 Jun 2021 20:18:06 +0000 (16:18 -0400)
Better than '{cluster_id}{export_id}', which is confusing and ambiguous.

Signed-off-by: Sage Weil <sage@newdream.net>
qa/tasks/cephfs/test_nfs.py
src/pybind/mgr/nfs/export.py

index 1e453ba1337e83466a9a3e23ff4416b8ebe0eb81..0ba781c2e7915505ddfab1e0b49921bc6118bc50 100644 (file)
@@ -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):
index 4469389ab61b1688e23e3ec748613c937eaecc31..84d46738112807ea38e402be8d399fba9aa2fae5 100644 (file)
@@ -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"