From: Avan Thakkar Date: Tue, 3 Sep 2024 13:15:47 +0000 (+0530) Subject: doc: nit fixes for nfs doc X-Git-Tag: v19.2.1~24^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=02bfd27317336c58bdf432a71243ddad9104f261;p=ceph.git doc: nit fixes for nfs doc Signed-off-by: Avan Thakkar Fixes some doc lint and also fixed qa tests for having both 3 & 4 protocols by default in expot config. (cherry picked from commit b895e596a88a9f4b0fe07dce082b369f4f04b8d2) --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 61c1258df243f..0037e5990d2c5 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -250,6 +250,7 @@ CephFS: Disallow delegating preallocated inode ranges to clients. Config - osd_op_num_threads_per_shard_hdd = 5 (was 1) For more details see https://tracker.ceph.com/issues/66289. * NFS: The export create/apply of CephFS based exports will now have a additional parameter `cmount_path` under FSAL block, +* NFS: The export create/apply of CephFS based exports will now have a additional parameter `cmount_path` under the FSAL block, which specifies the path within the CephFS to mount this export on. If this and the other `EXPORT { FSAL {} }` options are the same between multiple exports, those exports will share a single CephFS client. If not specified, the default is `/`. diff --git a/doc/mgr/nfs.rst b/doc/mgr/nfs.rst index ec020311a1962..c3e11b63310ff 100644 --- a/doc/mgr/nfs.rst +++ b/doc/mgr/nfs.rst @@ -318,10 +318,11 @@ values may be separated by a comma (example: ``--sectype krb5p,krb5i``). The server will negotatiate a supported security type with the client preferring the supplied methods left-to-right. -```` specifies the path within the ceph filesystem to mount this export on. It is +```` specifies the path within the CephFS to mount this export on. It is allowed to be any complete path hierarchy between ``/`` and the ``EXPORT {path}``. (i.e. if ``EXPORT { Path }`` parameter is ``/foo/bar`` then cmount_path could be ``/``, ``/foo`` or ``/foo/bar``). -!! If this and the other ``EXPORT { FSAL {} }`` options are the same between multiple exports, those exports will share a single cephfs client. -If not specified, the default is ``/``. + +.. note:: If this and the other ``EXPORT { FSAL {} }`` options are the same between multiple exports, those exports will share a single CephFS client. + If not specified, the default is ``/``. .. note:: Specifying values for sectype that require Kerberos will only function on servers that are configured to support Kerberos. Setting up NFS-Ganesha to support Kerberos @@ -499,7 +500,8 @@ provided JSON should fully describe the new state of the export (just as when creating a new export), with the exception of the authentication credentials, which will be carried over from the previous state of the export where possible. -The ``user_id`` in the ``fsal`` block should not be modified or mentioned in the JSON file as it is auto-generated for CephFS exports. + +!! NOTE: The ``user_id`` in the ``fsal`` block should not be modified or mentioned in the JSON file as it is auto-generated for CephFS exports. It's auto-generated in the format ``nfs...``. :: diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 12c28e35f657e..4f0e258683e75 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -235,12 +235,12 @@ class TestNFS(MgrTestCase): self._test_create_cluster() self._create_export(export_id='1', create_fs=True) - def _delete_export(self, pseduo_path=None): + def _delete_export(self, pseduo_path=None, check_in=False, user_id=None): ''' Delete an export. ''' self._nfs_cmd('export', 'rm', self.cluster_id, pseduo_path if pseduo_path else self.pseudo_path) - self._check_auth_ls(self.fs_name) + self._check_auth_ls(self.fs_name, check_in, user_id) def _test_list_export(self): ''' @@ -1145,70 +1145,14 @@ class TestNFS(MgrTestCase): self._delete_cluster_with_fs(self.fs_name, mnt_pt) self.ctx.cluster.run(args=['rm', '-rf', f'{mnt_pt}']) - def test_cephfs_export_update_with_nonexistent_dir(self): - """ - Test that invalid path is not allowed while updating a CephFS - export. - """ - self._create_cluster_with_fs(self.fs_name) - self._create_export(export_id=1) - - try: - self.update_export(self.cluster_id, "/not_existent_dir", - self.pseudo_path, self.fs_name) - except CommandFailedError as e: - if e.exitstatus != errno.ENOENT: - raise - - self._delete_export() - self._delete_cluster_with_fs(self.fs_name) - - def test_cephfs_export_update_at_non_dir_path(self): - """ - Test that non-directory path are not allowed while updating a CephFS - export. - """ - mnt_pt = '/mnt' - preserve_mode = self._sys_cmd(['stat', '-c', '%a', mnt_pt]) - self._create_cluster_with_fs(self.fs_name, mnt_pt) - try: - self.ctx.cluster.run(args=['touch', f'{mnt_pt}/testfile']) - self._create_export(export_id=1) - - # test at a file path - try: - self.update_export(self.cluster_id, "/testfile", - self.pseudo_path, self.fs_name) - except CommandFailedError as e: - if e.exitstatus != errno.ENOTDIR: - raise - - # test at a symlink path - self.ctx.cluster.run(args=['mkdir', f'{mnt_pt}/testdir']) - self.ctx.cluster.run(args=['ln', '-s', f'{mnt_pt}/testdir', - f'{mnt_pt}/testdir_symlink']) - try: - self.update_export(self.cluster_id, "/testdir_symlink", - self.pseudo_path, self.fs_name) - except CommandFailedError as e: - if e.exitstatus != errno.ENOTDIR: - raise - - # verify the path wasn't changed - export = json.loads(self._nfs_cmd("export", "ls", - self.cluster_id, "--detailed")) - self.assertEqual(export[0]["pseudo"], "/cephfs") - - finally: - self.ctx.cluster.run(args=['rm', '-rf', f'{mnt_pt}/*']) - self._delete_cluster_with_fs(self.fs_name, mnt_pt, preserve_mode) - def test_nfs_export_creation_without_cmount_path(self): """ Test that ensure cmount_path is present in FSAL block """ + self._create_cluster_with_fs(self.fs_name) + pseudo_path = '/test_without_cmount' - self._create_export(export_id='1234', + self._create_export(export_id='1', extra_cmd=['--pseudo-path', pseudo_path]) nfs_output = self._get_export(pseudo_path) self.assertIn('cmount_path', nfs_output['fsal']) @@ -1219,6 +1163,8 @@ class TestNFS(MgrTestCase): """ Test that exports with same FSAL share same user_id """ + self._create_cluster_with_fs(self.fs_name) + pseudo_path_1 = '/test1' pseudo_path_2 = '/test2' pseudo_path_3 = '/test3' @@ -1230,10 +1176,10 @@ class TestNFS(MgrTestCase): fs_path_1 = self._cmd('fs', 'subvolume', 'getpath', self.fs_name, 'sub_vol_1').strip() fs_path_2 = self._cmd('fs', 'subvolume', 'getpath', self.fs_name, 'sub_vol_2').strip() # Both exports should have same user_id(since cmount_path=/ & fs_name is same) - self._create_export(export_id='21', + self._create_export(export_id='1', extra_cmd=['--pseudo-path', pseudo_path_1, '--path', fs_path_1]) - self._create_export(export_id='22', + self._create_export(export_id='2', extra_cmd=['--pseudo-path', pseudo_path_2, '--path', fs_path_2]) @@ -1244,7 +1190,7 @@ class TestNFS(MgrTestCase): self.assertEqual(nfs_output_1['fsal']['user_id'], 'nfs.test.nfs-cephfs.3746f603') cmount_path = '/volumes' - self._create_export(export_id='23', + self._create_export(export_id='3', extra_cmd=['--pseudo-path', pseudo_path_3, '--path', fs_path_1, '--cmount-path', cmount_path]) @@ -1253,13 +1199,10 @@ class TestNFS(MgrTestCase): self.assertNotEqual(nfs_output_3['fsal']['user_id'], nfs_output_1['fsal']['user_id']) self.assertEqual(nfs_output_3['fsal']['user_id'], 'nfs.test.nfs-cephfs.32cd8545') - self._delete_export(pseudo_path_1) # Deleting export with same user_id should not delete the user_id - self._check_auth_ls(self.fs_name, True, nfs_output_2['fsal']['user_id']) - self._delete_export(pseudo_path_2) + self._delete_export(pseudo_path_1, True, nfs_output_1['fsal']['user_id']) # Deleting export 22 should delete the user_id since it's only export left with that user_id - self._check_auth_ls(self.fs_name, False, nfs_output_2['fsal']['user_id']) + self._delete_export(pseudo_path_2, False, nfs_output_2['fsal']['user_id']) - self._delete_export(pseudo_path_3) # Deleting export 23 should delete the user_id since it's only export with that user_id - self._check_auth_ls(self.fs_name, False, nfs_output_3['fsal']['user_id']) + self._delete_export(pseudo_path_3, False, nfs_output_3['fsal']['user_id'])