From: Venky Shankar Date: Fri, 29 Sep 2023 05:05:24 +0000 (+0530) Subject: Revert "quincy: qa: add subvolume option flavors" X-Git-Tag: v17.2.7~72^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F53729%2Fhead;p=ceph.git Revert "quincy: qa: add subvolume option flavors" Signed-off-by: Venky Shankar --- diff --git a/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml b/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml index b4c65cfc58ff..3e54df2a9bb8 100644 --- a/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml +++ b/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml @@ -5,4 +5,3 @@ tasks: - tasks.cephfs.test_volumes.TestVolumes - tasks.cephfs.test_volumes.TestSubvolumeGroups - tasks.cephfs.test_volumes.TestSubvolumes - - tasks.cephfs.test_subvolume.TestSubvolume diff --git a/qa/suites/fs/workload/subvolume/$ b/qa/suites/fs/workload/subvolume/$ deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/qa/suites/fs/workload/subvolume/no-subvolume.yaml b/qa/suites/fs/workload/subvolume/no-subvolume.yaml deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/qa/suites/fs/workload/subvolume/with-namespace-isolated-and-quota.yaml b/qa/suites/fs/workload/subvolume/with-namespace-isolated-and-quota.yaml deleted file mode 100644 index 7129e54b57a6..000000000000 --- a/qa/suites/fs/workload/subvolume/with-namespace-isolated-and-quota.yaml +++ /dev/null @@ -1,11 +0,0 @@ -overrides: - ceph: - subvols: - create: 2 - subvol_options: "--namespace-isolated --size 25000000000" - ceph-fuse: - client.0: - mount_subvol_num: 0 - kclient: - client.0: - mount_subvol_num: 1 diff --git a/qa/suites/fs/workload/subvolume/with-namespace-isolated.yaml b/qa/suites/fs/workload/subvolume/with-namespace-isolated.yaml deleted file mode 100644 index 2ac901fefd11..000000000000 --- a/qa/suites/fs/workload/subvolume/with-namespace-isolated.yaml +++ /dev/null @@ -1,11 +0,0 @@ -overrides: - ceph: - subvols: - create: 2 - subvol_options: "--namespace-isolated" - ceph-fuse: - client.0: - mount_subvol_num: 0 - kclient: - client.0: - mount_subvol_num: 1 diff --git a/qa/suites/fs/workload/subvolume/with-no-extra-options.yaml b/qa/suites/fs/workload/subvolume/with-no-extra-options.yaml deleted file mode 100644 index 40f98c2bc577..000000000000 --- a/qa/suites/fs/workload/subvolume/with-no-extra-options.yaml +++ /dev/null @@ -1,10 +0,0 @@ -overrides: - ceph: - subvols: - create: 2 - ceph-fuse: - client.0: - mount_subvol_num: 0 - kclient: - client.0: - mount_subvol_num: 1 diff --git a/qa/suites/fs/workload/subvolume/with-quota.yaml b/qa/suites/fs/workload/subvolume/with-quota.yaml deleted file mode 100644 index 6cda00d4a232..000000000000 --- a/qa/suites/fs/workload/subvolume/with-quota.yaml +++ /dev/null @@ -1,11 +0,0 @@ -overrides: - ceph: - subvols: - create: 2 - subvol_options: "--size 25000000000" - ceph-fuse: - client.0: - mount_subvol_num: 0 - kclient: - client.0: - mount_subvol_num: 1 diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index 3c1194542c0b..b13f73bafed6 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -444,9 +444,6 @@ def cephfs_setup(ctx, config): name = fs_config.pop('name') temp = deepcopy(cephfs_config) teuthology.deep_merge(temp, fs_config) - subvols = config.get('subvols', None) - if subvols: - teuthology.deep_merge(temp, {'subvols': subvols}) fs = Filesystem(ctx, fs_config=temp, name=name, create=True) fss.append(fs) diff --git a/qa/tasks/ceph_fuse.py b/qa/tasks/ceph_fuse.py index b443516230c0..2712229f9723 100644 --- a/qa/tasks/ceph_fuse.py +++ b/qa/tasks/ceph_fuse.py @@ -72,20 +72,6 @@ def task(ctx, config): mount_timeout: 120 # default is 30, give up if /sys/ is not populated - interactive: - Example that creates and mounts a subvol: - - overrides: - ceph: - subvols: - create: 2 - subvol_options: "--namespace-isolated --size 25000000000" - ceph-fuse: - client.0: - mount_subvol_num: 0 - kclient: - client.1: - mount_subvol_num: 1 - :param ctx: Context :param config: Configuration """ diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 5f88dcfdd768..e54a9d98faa3 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -890,9 +890,6 @@ def cephfs_setup(ctx, config): name = fs_config.pop('name') temp = deepcopy(cephfs_config) teuthology.deep_merge(temp, fs_config) - subvols = config.get('subvols', None) - if subvols: - teuthology.deep_merge(temp, {'subvols': subvols}) fs = Filesystem(ctx, fs_config=temp, name=name, create=True) if set_allow_multifs: fs.set_allow_multifs() diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 27fa00f54845..269a818a41cd 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -719,7 +719,6 @@ class Filesystem(MDSCluster): raise if self.fs_config is not None: - log.debug(f"fs_config: {self.fs_config}") max_mds = self.fs_config.get('max_mds', 1) if max_mds > 1: self.set_max_mds(max_mds) @@ -732,34 +731,6 @@ class Filesystem(MDSCluster): if session_timeout != 60: self.set_session_timeout(session_timeout) - if self.fs_config.get('subvols', None) is not None: - log.debug(f"Creating {self.fs_config.get('subvols')} subvols " - f"for filesystem '{self.name}'") - if not hasattr(self._ctx, "created_subvols"): - self._ctx.created_subvols = dict() - - subvols = self.fs_config.get('subvols') - assert(isinstance(subvols, dict)) - assert(isinstance(subvols['create'], int)) - assert(subvols['create'] > 0) - - for sv in range(0, subvols['create']): - sv_name = f'sv_{sv}' - self.mon_manager.raw_cluster_cmd( - 'fs', 'subvolume', 'create', self.name, sv_name, - self.fs_config.get('subvol_options', '')) - - if self.name not in self._ctx.created_subvols: - self._ctx.created_subvols[self.name] = [] - - subvol_path = self.mon_manager.raw_cluster_cmd( - 'fs', 'subvolume', 'getpath', self.name, sv_name) - subvol_path = subvol_path.strip() - self._ctx.created_subvols[self.name].append(subvol_path) - else: - log.debug(f"Not Creating any subvols for filesystem '{self.name}'") - - self.getinfo(refresh = True) # wait pgs to be clean diff --git a/qa/tasks/cephfs/fuse_mount.py b/qa/tasks/cephfs/fuse_mount.py index 350c4c163727..6c82379e26ed 100644 --- a/qa/tasks/cephfs/fuse_mount.py +++ b/qa/tasks/cephfs/fuse_mount.py @@ -113,12 +113,8 @@ class FuseMount(CephFSMount): mount_cmd += ['--id', self.client_id] if self.client_keyring_path and self.client_id: mount_cmd += ['-k', self.client_keyring_path] - - self.validate_subvol_options() - if self.cephfs_mntpt: mount_cmd += ["--client_mountpoint=" + self.cephfs_mntpt] - if self.cephfs_name: mount_cmd += ["--client_fs=" + self.cephfs_name] if mntopts: diff --git a/qa/tasks/cephfs/kernel_mount.py b/qa/tasks/cephfs/kernel_mount.py index 59c57ea7eb6c..f20fcc3cda1c 100644 --- a/qa/tasks/cephfs/kernel_mount.py +++ b/qa/tasks/cephfs/kernel_mount.py @@ -46,6 +46,8 @@ class KernelMount(CephFSMount): self.setup_netns() + if not self.cephfs_mntpt: + self.cephfs_mntpt = '/' if not self.cephfs_name: self.cephfs_name = 'cephfs' @@ -85,10 +87,6 @@ class KernelMount(CephFSMount): def _make_mount_cmd_old_or_new_style(self): optd = {} mnt_stx = '' - - self.validate_subvol_options() - - assert(self.cephfs_mntpt) if self.syntax_style == 'v1': mnt_stx = f':{self.cephfs_mntpt}' if self.client_id: diff --git a/qa/tasks/cephfs/mount.py b/qa/tasks/cephfs/mount.py index 6f24ec98a481..b57dc787ad57 100644 --- a/qa/tasks/cephfs/mount.py +++ b/qa/tasks/cephfs/mount.py @@ -1427,19 +1427,3 @@ class CephFSMount(object): checksum_text = self.run_shell(cmd).stdout.getvalue().strip() checksum_sorted = sorted(checksum_text.split('\n'), key=lambda v: v.split()[1]) return hashlib.md5(('\n'.join(checksum_sorted)).encode('utf-8')).hexdigest() - - def validate_subvol_options(self): - mount_subvol_num = self.client_config.get('mount_subvol_num', None) - if self.cephfs_mntpt and mount_subvol_num is not None: - log.warning("You cannot specify both: cephfs_mntpt and mount_subvol_num") - log.info(f"Mounting subvol {mount_subvol_num} for now") - - if mount_subvol_num is not None: - # mount_subvol must be an index into the subvol path array for the fs - if not self.cephfs_name: - self.cephfs_name = 'cephfs' - assert(hasattr(self.ctx, "created_subvols")) - # mount_subvol must be specified under client.[0-9] yaml section - subvol_paths = self.ctx.created_subvols[self.cephfs_name] - path_to_mount = subvol_paths[mount_subvol_num] - self.cephfs_mntpt = path_to_mount diff --git a/qa/tasks/cephfs/test_subvolume.py b/qa/tasks/cephfs/test_subvolume.py deleted file mode 100644 index 1ebb137dda93..000000000000 --- a/qa/tasks/cephfs/test_subvolume.py +++ /dev/null @@ -1,170 +0,0 @@ -import logging - -from tasks.cephfs.cephfs_test_case import CephFSTestCase -from teuthology.exceptions import CommandFailedError - -log = logging.getLogger(__name__) - - -class TestSubvolume(CephFSTestCase): - CLIENTS_REQUIRED = 1 - MDSS_REQUIRED = 1 - - def setUp(self): - super().setUp() - self.setup_test() - - def tearDown(self): - # clean up - self.cleanup_test() - super().tearDown() - - def setup_test(self): - self.mount_a.run_shell(['mkdir', 'group']) - self.mount_a.run_shell(['mkdir', 'group/subvol1']) - self.mount_a.run_shell(['setfattr', '-n', 'ceph.dir.subvolume', - '-v', '1', 'group/subvol1']) - self.mount_a.run_shell(['mv', 'group/subvol1', 'group/subvol2']) - - def cleanup_test(self): - self.mount_a.run_shell(['rm', '-rf', 'group']) - - def test_subvolume_move_out_file(self): - """ - To verify that file can't be moved out of subvolume - """ - self.mount_a.run_shell(['touch', 'group/subvol2/file1']) - - # file can't be moved out of a subvolume - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['rename', 'group/subvol2/file1', - 'group/file1', 'group/subvol2/file1']) - - - def test_subvolume_move_in_file(self): - """ - To verify that file can't be moved into subvolume - """ - # file can't be moved into a subvolume - self.mount_a.run_shell(['touch', 'group/file2']) - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['rename', 'group/file2', - 'group/subvol2/file2', 'group/file2']) - - def test_subvolume_hardlink_to_outside(self): - """ - To verify that file can't be hardlinked to outside subvolume - """ - self.mount_a.run_shell(['touch', 'group/subvol2/file1']) - - # create hard link within subvolume - self.mount_a.run_shell(['ln', - 'group/subvol2/file1', 'group/subvol2/file1_']) - - # hard link can't be created out of subvolume - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['ln', - 'group/subvol2/file1', 'group/file1_']) - - def test_subvolume_hardlink_to_inside(self): - """ - To verify that file can't be hardlinked to inside subvolume - """ - self.mount_a.run_shell(['touch', 'group/subvol2/file1']) - - # create hard link within subvolume - self.mount_a.run_shell(['ln', - 'group/subvol2/file1', 'group/subvol2/file1_']) - - # hard link can't be created inside subvolume - self.mount_a.run_shell(['touch', 'group/file2']) - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['ln', - 'group/file2', 'group/subvol2/file2_']) - - def test_subvolume_snapshot_inside_subvolume_subdir(self): - """ - To verify that snapshot can't be taken for a subvolume subdir - """ - self.mount_a.run_shell(['touch', 'group/subvol2/file1']) - - # create snapshot at subvolume root - self.mount_a.run_shell(['mkdir', 'group/subvol2/.snap/s1']) - - # can't create snapshot in a descendent dir of subvolume - self.mount_a.run_shell(['mkdir', 'group/subvol2/dir']) - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['mkdir', 'group/subvol2/dir/.snap/s2']) - - # clean up - self.mount_a.run_shell(['rmdir', 'group/subvol2/.snap/s1']) - - def test_subvolume_file_move_across_subvolumes(self): - """ - To verify that file can't be moved across subvolumes - """ - self.mount_a.run_shell(['touch', 'group/subvol2/file1']) - - # create another subvol - self.mount_a.run_shell(['mkdir', 'group/subvol3']) - self.mount_a.run_shell(['setfattr', '-n', 'ceph.dir.subvolume', - '-v', '1', 'group/subvol3']) - - # can't move file across subvolumes - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['rename', 'group/subvol2/file1', - 'group/subvol3/file1', - 'group/subvol2/file1']) - - def test_subvolume_hardlink_across_subvolumes(self): - """ - To verify that hardlink can't be created across subvolumes - """ - self.mount_a.run_shell(['touch', 'group/subvol2/file1']) - - # create another subvol - self.mount_a.run_shell(['mkdir', 'group/subvol3']) - self.mount_a.run_shell(['setfattr', '-n', 'ceph.dir.subvolume', - '-v', '1', 'group/subvol3']) - - # can't create hard link across subvolumes - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['ln', 'group/subvol2/file1', - 'group/subvol3/file1']) - - def test_subvolume_create_subvolume_inside_subvolume(self): - """ - To verify that subvolume can't be created inside a subvolume - """ - # can't create subvolume inside a subvolume - self.mount_a.run_shell(['mkdir', 'group/subvol2/dir']) - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['setfattr', '-n', 'ceph.dir.subvolume', - '-v', '1', 'group/subvol2/dir']) - - def test_subvolume_create_snapshot_inside_new_subvolume_parent(self): - """ - To verify that subvolume can't be created inside a new subvolume parent - """ - self.mount_a.run_shell(['touch', 'group/subvol2/file1']) - - # clear subvolume flag - self.mount_a.run_shell(['setfattr', '-n', 'ceph.dir.subvolume', - '-v', '0', 'group/subvol2']) - - # create a snap - self.mount_a.run_shell(['mkdir', 'group/subvol2/dir']) - self.mount_a.run_shell(['mkdir', 'group/subvol2/dir/.snap/s2']) - - # override subdir subvolume with parent subvolume - self.mount_a.run_shell(['setfattr', '-n', 'ceph.dir.subvolume', - '-v', '1', 'group/subvol2/dir']) - self.mount_a.run_shell(['setfattr', '-n', 'ceph.dir.subvolume', - '-v', '1', 'group/subvol2']) - - # can't create a snap in a subdir of a subvol parent - with self.assertRaises(CommandFailedError): - self.mount_a.run_shell(['mkdir', 'group/subvol2/dir/.snap/s3']) - - # clean up - self.mount_a.run_shell(['rmdir', 'group/subvol2/dir/.snap/s2']) diff --git a/qa/workunits/fs/misc/subvolume.sh b/qa/workunits/fs/misc/subvolume.sh new file mode 100755 index 000000000000..75716a6cf6bb --- /dev/null +++ b/qa/workunits/fs/misc/subvolume.sh @@ -0,0 +1,63 @@ +#!/bin/sh -x + +expect_failure() { + if "$@"; then return 1; else return 0; fi +} + +set -e + +mkdir group +mkdir group/subvol1 + +setfattr -n ceph.dir.subvolume -v 1 group/subvol1 + +# rename subvolume +mv group/subvol1 group/subvol2 + +# move file out of the subvolume +touch group/subvol2/file1 +expect_failure python3 -c "import os; os.rename('group/subvol2/file1', 'group/file1')" +# move file into the subvolume +touch group/file2 +expect_failure python3 -c "import os; os.rename('group/file2', 'group/subvol2/file2')" + +# create hardlink within subvolume +ln group/subvol2/file1 group/subvol2/file1_ + +# create hardlink out of subvolume +expect_failure ln group/subvol2/file1 group/file1_ +expect_failure ln group/file2 group/subvol1/file2_ + +# create snapshot at subvolume root +mkdir group/subvol2/.snap/s1 + +# create snapshot at descendent dir of subvolume +mkdir group/subvol2/dir +expect_failure mkdir group/subvol2/dir/.snap/s2 + +mkdir group/subvol3 +setfattr -n ceph.dir.subvolume -v 1 group/subvol3 + +# move file across subvolumes +expect_failure python3 -c "import os; os.rename('group/subvol2/file1', 'group/subvol3/file1')" + +# create hardlink across subvolumes +expect_failure ln group/subvol2/file1 group/subvol3/file1 + +# create subvolume inside existing subvolume +expect_failure setfattr -n ceph.dir.subvolume -v 1 group/subvol2/dir + +# clear subvolume flag +setfattr -n ceph.dir.subvolume -v 0 group/subvol2 +mkdir group/subvol2/dir/.snap/s2 + +# parent subvolume override child subvolume +setfattr -n ceph.dir.subvolume -v 1 group/subvol2/dir +setfattr -n ceph.dir.subvolume -v 1 group/subvol2 +expect_failure mkdir group/subvol2/dir/.snap/s3 + +rmdir group/subvol2/.snap/s1 +rmdir group/subvol2/dir/.snap/s2 +rm -rf group + +echo OK