summaryrefslogtreecommitdiffstats
path: root/qa/tasks/cephfs/test_volumes.py
diff options
context:
space:
mode:
Diffstat (limited to 'qa/tasks/cephfs/test_volumes.py')
-rw-r--r--qa/tasks/cephfs/test_volumes.py1200
1 files changed, 739 insertions, 461 deletions
diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py
index 2ecfeb327..612a4ef41 100644
--- a/qa/tasks/cephfs/test_volumes.py
+++ b/qa/tasks/cephfs/test_volumes.py
@@ -19,11 +19,6 @@ log = logging.getLogger(__name__)
class TestVolumesHelper(CephFSTestCase):
"""Helper class for testing FS volume, subvolume group and subvolume operations."""
- TEST_VOLUME_PREFIX = "volume"
- TEST_SUBVOLUME_PREFIX="subvolume"
- TEST_GROUP_PREFIX="group"
- TEST_SNAPSHOT_PREFIX="snapshot"
- TEST_CLONE_PREFIX="clone"
TEST_FILE_NAME_PREFIX="subvolume_file"
# for filling subvolume with data
@@ -35,10 +30,10 @@ class TestVolumesHelper(CephFSTestCase):
DEFAULT_NUMBER_OF_FILES = 1024
def _fs_cmd(self, *args):
- return self.mgr_cluster.mon_manager.raw_cluster_cmd("fs", *args)
+ return self.get_ceph_cmd_stdout("fs", *args)
def _raw_cmd(self, *args):
- return self.mgr_cluster.mon_manager.raw_cluster_cmd(*args)
+ return self.get_ceph_cmd_stdout(args)
def __check_clone_state(self, state, clone, clone_group=None, timo=120):
check = 0
@@ -165,35 +160,24 @@ class TestVolumesHelper(CephFSTestCase):
self._verify_clone_root(path1, path2, clone, clone_group, clone_pool)
self._verify_clone_attrs(path1, path2)
- def _generate_random_volume_name(self, count=1):
- n = self.volume_start
- volumes = [f"{TestVolumes.TEST_VOLUME_PREFIX}_{i:016}" for i in range(n, n+count)]
- self.volume_start += count
- return volumes[0] if count == 1 else volumes
-
- def _generate_random_subvolume_name(self, count=1):
- n = self.subvolume_start
- subvolumes = [f"{TestVolumes.TEST_SUBVOLUME_PREFIX}_{i:016}" for i in range(n, n+count)]
- self.subvolume_start += count
- return subvolumes[0] if count == 1 else subvolumes
-
- def _generate_random_group_name(self, count=1):
- n = self.group_start
- groups = [f"{TestVolumes.TEST_GROUP_PREFIX}_{i:016}" for i in range(n, n+count)]
- self.group_start += count
- return groups[0] if count == 1 else groups
-
- def _generate_random_snapshot_name(self, count=1):
- n = self.snapshot_start
- snaps = [f"{TestVolumes.TEST_SNAPSHOT_PREFIX}_{i:016}" for i in range(n, n+count)]
- self.snapshot_start += count
- return snaps[0] if count == 1 else snaps
-
- def _generate_random_clone_name(self, count=1):
- n = self.clone_start
- clones = [f"{TestVolumes.TEST_CLONE_PREFIX}_{i:016}" for i in range(n, n+count)]
- self.clone_start += count
- return clones[0] if count == 1 else clones
+ def _gen_name(self, name, n):
+ names = [f'{name}{random.randrange(0, 9999)}{i}' for i in range(n)]
+ return names[0] if n == 1 else names
+
+ def _gen_vol_name(self, n=1):
+ return self._gen_name('vol', n)
+
+ def _gen_subvol_name(self, n=1):
+ return self._gen_name('subvol', n)
+
+ def _gen_subvol_grp_name(self, n=1):
+ return self._gen_name('subvol_grp', n)
+
+ def _gen_subvol_snap_name(self, n=1):
+ return self._gen_name('subvol_snap', n)
+
+ def _gen_subvol_clone_name(self, n=1):
+ return self._gen_name('subvol_clone', n)
def _enable_multi_fs(self):
self._fs_cmd("flag", "set", "enable_multiple", "true", "--yes-i-really-mean-it")
@@ -202,7 +186,7 @@ class TestVolumesHelper(CephFSTestCase):
result = json.loads(self._fs_cmd("volume", "ls"))
if len(result) == 0:
self.vol_created = True
- self.volname = self._generate_random_volume_name()
+ self.volname = self._gen_vol_name()
self._fs_cmd("volume", "create", self.volname)
else:
self.volname = result[0]['name']
@@ -393,14 +377,16 @@ class TestVolumesHelper(CephFSTestCase):
""".format(authid=authid,key=key))
guest_mount.client_id = authid
- guest_mount.client_remote.write_file(guest_mount.get_keyring_path(),
- keyring_txt, sudo=True)
+ guest_keyring_path = guest_mount.client_remote.mktemp(
+ data=keyring_txt)
# Add a guest client section to the ceph config file.
self.config_set("client.{0}".format(authid), "debug client", 20)
self.config_set("client.{0}".format(authid), "debug objecter", 20)
self.set_conf("client.{0}".format(authid),
"keyring", guest_mount.get_keyring_path())
+ return guest_keyring_path
+
def _auth_metadata_get(self, filedata):
"""
Return a deserialized JSON object, or None
@@ -418,11 +404,6 @@ class TestVolumesHelper(CephFSTestCase):
self._enable_multi_fs()
self._create_or_reuse_test_volume()
self.config_set('mon', 'mon_allow_pool_delete', True)
- self.volume_start = random.randint(1, (1<<20))
- self.subvolume_start = random.randint(1, (1<<20))
- self.group_start = random.randint(1, (1<<20))
- self.snapshot_start = random.randint(1, (1<<20))
- self.clone_start = random.randint(1, (1<<20))
def tearDown(self):
if self.vol_created:
@@ -436,7 +417,7 @@ class TestVolumes(TestVolumesHelper):
"""
That the volume can be created and then cleans up
"""
- volname = self._generate_random_volume_name()
+ volname = self._gen_vol_name()
self._fs_cmd("volume", "create", volname)
volumels = json.loads(self._fs_cmd("volume", "ls"))
@@ -467,7 +448,7 @@ class TestVolumes(TestVolumesHelper):
volumes = [volume['name'] for volume in vls]
#create new volumes and add it to the existing list of volumes
- volumenames = self._generate_random_volume_name(2)
+ volumenames = self._gen_vol_name(2)
for volumename in volumenames:
self._fs_cmd("volume", "create", volumename)
volumes.extend(volumenames)
@@ -562,6 +543,102 @@ class TestVolumes(TestVolumesHelper):
self.assertNotIn(pool["name"], pools,
"pool {0} exists after volume removal".format(pool["name"]))
+ def test_volume_info(self):
+ """
+ Tests the 'fs volume info' command
+ """
+ vol_fields = ["pools", "used_size", "pending_subvolume_deletions", "mon_addrs"]
+ group = self._gen_subvol_grp_name()
+ # create subvolumegroup
+ self._fs_cmd("subvolumegroup", "create", self.volname, group)
+ # get volume metadata
+ vol_info = json.loads(self._get_volume_info(self.volname))
+ for md in vol_fields:
+ self.assertIn(md, vol_info,
+ f"'{md}' key not present in metadata of volume")
+ self.assertEqual(vol_info["used_size"], 0,
+ "Size should be zero when volumes directory is empty")
+
+ def test_volume_info_pending_subvol_deletions(self):
+ """
+ Tests the pending_subvolume_deletions in 'fs volume info' command
+ """
+ subvolname = self._gen_subvol_name()
+ # create subvolume
+ self._fs_cmd("subvolume", "create", self.volname, subvolname, "--mode=777")
+ # create 3K zero byte files
+ self._do_subvolume_io(subvolname, number_of_files=3000, file_size=0)
+ # Delete the subvolume
+ self._fs_cmd("subvolume", "rm", self.volname, subvolname)
+ # get volume metadata
+ vol_info = json.loads(self._get_volume_info(self.volname))
+ self.assertNotEqual(vol_info['pending_subvolume_deletions'], 0,
+ "pending_subvolume_deletions should be 1")
+ # verify trash dir is clean
+ self._wait_for_trash_empty()
+
+ def test_volume_info_without_subvolumegroup(self):
+ """
+ Tests the 'fs volume info' command without subvolume group
+ """
+ vol_fields = ["pools", "mon_addrs"]
+ # get volume metadata
+ vol_info = json.loads(self._get_volume_info(self.volname))
+ for md in vol_fields:
+ self.assertIn(md, vol_info,
+ f"'{md}' key not present in metadata of volume")
+ self.assertNotIn("used_size", vol_info,
+ "'used_size' should not be present in absence of subvolumegroup")
+ self.assertNotIn("pending_subvolume_deletions", vol_info,
+ "'pending_subvolume_deletions' should not be present in absence"
+ " of subvolumegroup")
+
+ def test_volume_info_with_human_readable_flag(self):
+ """
+ Tests the 'fs volume info --human_readable' command
+ """
+ vol_fields = ["pools", "used_size", "pending_subvolume_deletions", "mon_addrs"]
+ group = self._gen_subvol_grp_name()
+ # create subvolumegroup
+ self._fs_cmd("subvolumegroup", "create", self.volname, group)
+ # get volume metadata
+ vol_info = json.loads(self._get_volume_info(self.volname, "--human_readable"))
+ for md in vol_fields:
+ self.assertIn(md, vol_info,
+ f"'{md}' key not present in metadata of volume")
+ units = [' ', 'k', 'M', 'G', 'T', 'P', 'E']
+ assert vol_info["used_size"][-1] in units, "unit suffix in used_size is absent"
+ assert vol_info["pools"]["data"][0]["avail"][-1] in units, "unit suffix in avail data is absent"
+ assert vol_info["pools"]["data"][0]["used"][-1] in units, "unit suffix in used data is absent"
+ assert vol_info["pools"]["metadata"][0]["avail"][-1] in units, "unit suffix in avail metadata is absent"
+ assert vol_info["pools"]["metadata"][0]["used"][-1] in units, "unit suffix in used metadata is absent"
+ self.assertEqual(int(vol_info["used_size"]), 0,
+ "Size should be zero when volumes directory is empty")
+
+ def test_volume_info_with_human_readable_flag_without_subvolumegroup(self):
+ """
+ Tests the 'fs volume info --human_readable' command without subvolume group
+ """
+ vol_fields = ["pools", "mon_addrs"]
+ # get volume metadata
+ vol_info = json.loads(self._get_volume_info(self.volname, "--human_readable"))
+ for md in vol_fields:
+ self.assertIn(md, vol_info,
+ f"'{md}' key not present in metadata of volume")
+ units = [' ', 'k', 'M', 'G', 'T', 'P', 'E']
+ assert vol_info["pools"]["data"][0]["avail"][-1] in units, "unit suffix in avail data is absent"
+ assert vol_info["pools"]["data"][0]["used"][-1] in units, "unit suffix in used data is absent"
+ assert vol_info["pools"]["metadata"][0]["avail"][-1] in units, "unit suffix in avail metadata is absent"
+ assert vol_info["pools"]["metadata"][0]["used"][-1] in units, "unit suffix in used metadata is absent"
+ self.assertNotIn("used_size", vol_info,
+ "'used_size' should not be present in absence of subvolumegroup")
+ self.assertNotIn("pending_subvolume_deletions", vol_info,
+ "'pending_subvolume_deletions' should not be present in absence"
+ " of subvolumegroup")
+
+
+class TestRenameCmd(TestVolumesHelper):
+
def test_volume_rename(self):
"""
That volume, its file system and pools, can be renamed.
@@ -569,7 +646,7 @@ class TestVolumes(TestVolumesHelper):
for m in self.mounts:
m.umount_wait()
oldvolname = self.volname
- newvolname = self._generate_random_volume_name()
+ newvolname = self._gen_vol_name()
new_data_pool, new_metadata_pool = f"cephfs.{newvolname}.data", f"cephfs.{newvolname}.meta"
self._fs_cmd("volume", "rename", oldvolname, newvolname,
"--yes-i-really-mean-it")
@@ -590,7 +667,7 @@ class TestVolumes(TestVolumesHelper):
for m in self.mounts:
m.umount_wait()
oldvolname = self.volname
- newvolname = self._generate_random_volume_name()
+ newvolname = self._gen_vol_name()
new_data_pool, new_metadata_pool = f"cephfs.{newvolname}.data", f"cephfs.{newvolname}.meta"
self._fs_cmd("volume", "rename", oldvolname, newvolname,
"--yes-i-really-mean-it")
@@ -608,7 +685,8 @@ class TestVolumes(TestVolumesHelper):
"""
That renaming volume fails without --yes-i-really-mean-it flag.
"""
- newvolname = self._generate_random_volume_name()
+ newvolname = self._gen_vol_name()
+
try:
self._fs_cmd("volume", "rename", self.volname, newvolname)
except CommandFailedError as ce:
@@ -628,7 +706,7 @@ class TestVolumes(TestVolumesHelper):
m.umount_wait()
self.fs.add_data_pool('another-data-pool')
oldvolname = self.volname
- newvolname = self._generate_random_volume_name()
+ newvolname = self._gen_vol_name()
self.fs.get_pool_names(refresh=True)
orig_data_pool_names = list(self.fs.data_pools.values())
new_metadata_pool = f"cephfs.{newvolname}.meta"
@@ -650,7 +728,7 @@ class TestVolumes(TestVolumesHelper):
Tests the 'fs volume info' command
"""
vol_fields = ["pools", "used_size", "pending_subvolume_deletions", "mon_addrs"]
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
# create subvolumegroup
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# get volume metadata
@@ -665,7 +743,7 @@ class TestVolumes(TestVolumesHelper):
"""
Tests the pending_subvolume_deletions in 'fs volume info' command
"""
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--mode=777")
# create 3K zero byte files
@@ -700,7 +778,7 @@ class TestVolumes(TestVolumesHelper):
Tests the 'fs volume info --human_readable' command
"""
vol_fields = ["pools", "used_size", "pending_subvolume_deletions", "mon_addrs"]
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
# create subvolumegroup
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# get volume metadata
@@ -742,7 +820,7 @@ class TestVolumes(TestVolumesHelper):
class TestSubvolumeGroups(TestVolumesHelper):
"""Tests for FS subvolume group operations."""
def test_default_uid_gid_subvolume_group(self):
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
expected_uid = 0
expected_gid = 0
@@ -759,7 +837,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
def test_nonexistent_subvolume_group_create(self):
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
group = "non_existent_group"
# try, creating subvolume in a nonexistent group
@@ -784,7 +862,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
raise RuntimeError("expected the 'fs subvolumegroup rm' command to fail")
def test_subvolume_group_create_with_auto_cleanup_on_fail(self):
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
data_pool = "invalid_pool"
# create group with invalid data pool layout
with self.assertRaises(CommandFailedError):
@@ -800,7 +878,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
raise RuntimeError("expected the 'fs subvolumegroup getpath' command to fail")
def test_subvolume_group_create_with_desired_data_pool_layout(self):
- group1, group2 = self._generate_random_group_name(2)
+ group1, group2 = self._gen_subvol_grp_name(2)
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group1)
@@ -828,7 +906,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self._fs_cmd("subvolumegroup", "rm", self.volname, group2)
def test_subvolume_group_create_with_desired_mode(self):
- group1, group2 = self._generate_random_group_name(2)
+ group1, group2 = self._gen_subvol_grp_name(2)
# default mode
expected_mode1 = "755"
# desired mode
@@ -862,7 +940,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
gid = 1000
# create subvolume group
- subvolgroupname = self._generate_random_group_name()
+ subvolgroupname = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, subvolgroupname, "--uid", str(uid), "--gid", str(gid))
# make sure it exists
@@ -879,7 +957,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self._fs_cmd("subvolumegroup", "rm", self.volname, subvolgroupname)
def test_subvolume_group_create_with_invalid_data_pool_layout(self):
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
data_pool = "invalid_pool"
# create group with invalid data pool layout
try:
@@ -892,7 +970,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
def test_subvolume_group_create_with_size(self):
# create group with size -- should set quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group, "1000000000")
# get group metadata
@@ -909,7 +987,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
"data_pool", "gid", "mode", "mon_addrs", "mtime", "uid"]
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# get group metadata
@@ -938,7 +1016,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
def test_subvolume_group_create_idempotence(self):
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# try creating w/ same subvolume group name -- should be idempotent
@@ -949,7 +1027,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
def test_subvolume_group_create_idempotence_mode(self):
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# try creating w/ same subvolume group name with mode -- should set mode
@@ -969,7 +1047,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
desired_gid = 1000
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# try creating w/ same subvolume group name with uid/gid -- should set uid/gid
@@ -988,7 +1066,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
def test_subvolume_group_create_idempotence_data_pool(self):
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group)
group_path = self._get_subvolume_group_path(self.volname, group)
@@ -1013,7 +1091,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
def test_subvolume_group_create_idempotence_resize(self):
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# try creating w/ same subvolume name with size -- should set quota
@@ -1035,7 +1113,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""
osize = self.DEFAULT_FILE_SIZE*1024*1024*100
# create group with 100MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize), "--mode=777")
@@ -1044,7 +1122,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self.assertNotEqual(grouppath, None)
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname,
"--group_name", group, "--mode=777")
@@ -1054,7 +1132,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
# Create auth_id
authid = "client.guest1"
- user = json.loads(self.fs.mon_manager.raw_cluster_cmd(
+ user = json.loads(self.get_ceph_cmd_stdout(
"auth", "get-or-create", authid,
"mds", "allow rw path=/volumes",
"mgr", "allow rw",
@@ -1068,11 +1146,12 @@ class TestSubvolumeGroups(TestVolumesHelper):
guest_mount.umount_wait()
# configure credentials for guest client
- self._configure_guest_auth(guest_mount, "guest1", user[0]["key"])
-
+ guest_keyring_path = self._configure_guest_auth(
+ guest_mount, "guest1", user[0]["key"])
# mount the subvolume
mount_path = os.path.join("/", subvolpath)
- guest_mount.mount_wait(cephfs_mntpt=mount_path)
+ guest_mount.mount_wait(cephfs_mntpt=mount_path,
+ client_keyring_path=guest_keyring_path)
# create 99 files of 1MB
guest_mount.run_shell_payload("mkdir -p dir1")
@@ -1119,7 +1198,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""
osize = self.DEFAULT_FILE_SIZE*1024*1024*100
# create group with 100MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize), "--mode=777")
@@ -1128,7 +1207,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self.assertNotEqual(grouppath, None)
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname,
"--group_name", group, "--mode=777")
@@ -1140,7 +1219,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
# Create auth_id
authid = "client.guest1"
- user = json.loads(self.fs.mon_manager.raw_cluster_cmd(
+ user = json.loads(self.get_ceph_cmd_stdout(
"auth", "get-or-create", authid,
"mds", f"allow rw path={mount_path}",
"mgr", "allow rw",
@@ -1154,10 +1233,11 @@ class TestSubvolumeGroups(TestVolumesHelper):
guest_mount.umount_wait()
# configure credentials for guest client
- self._configure_guest_auth(guest_mount, "guest1", user[0]["key"])
-
+ guest_keyring_path = self._configure_guest_auth(
+ guest_mount, "guest1", user[0]["key"])
# mount the subvolume
- guest_mount.mount_wait(cephfs_mntpt=mount_path)
+ guest_mount.mount_wait(cephfs_mntpt=mount_path,
+ client_keyring_path=guest_keyring_path)
# create 99 files of 1MB to exceed quota
guest_mount.run_shell_payload("mkdir -p dir1")
@@ -1200,7 +1280,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""
osize = self.DEFAULT_FILE_SIZE*1024*1024*100
# create group with 100MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize), "--mode=777")
@@ -1209,7 +1289,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self.assertNotEqual(grouppath, None)
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname,
"--group_name", group, "--mode=777")
@@ -1243,9 +1323,9 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""
Tests retained snapshot subvolume removal if it's group quota is exceeded
"""
- group = self._generate_random_group_name()
- subvolname = self._generate_random_subvolume_name()
- snapshot1, snapshot2 = self._generate_random_snapshot_name(2)
+ group = self._gen_subvol_grp_name()
+ subvolname = self._gen_subvol_name()
+ snapshot1, snapshot2 = self._gen_subvol_snap_name(2)
osize = self.DEFAULT_FILE_SIZE*1024*1024*100
# create group with 100MB quota
@@ -1301,11 +1381,11 @@ class TestSubvolumeGroups(TestVolumesHelper):
Tests subvolume removal if it's group quota is set.
"""
# create group with size -- should set quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group, "1000000000")
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--group_name", group)
# remove subvolume
@@ -1324,8 +1404,8 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""
Tests legacy subvolume removal if it's group quota is set.
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# emulate a old-fashioned subvolume -- in a custom group
createpath1 = os.path.join(".", "volumes", group, subvolume)
@@ -1358,8 +1438,8 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""
Tests v1 subvolume removal if it's group quota is set.
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# emulate a v1 subvolume -- in a custom group
self._create_v1_subvolume(subvolume, subvol_group=group, has_snapshot=False)
@@ -1386,7 +1466,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024
# create group with 1MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group, "--size", str(osize))
# make sure it exists
@@ -1417,7 +1497,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024
# create group with 1MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group, "--size", str(osize))
# make sure it exists
@@ -1449,7 +1529,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024*20
# create group with 20MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize), "--mode=777")
@@ -1458,7 +1538,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self.assertNotEqual(grouppath, None)
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname,
"--group_name", group, "--mode=777")
@@ -1503,7 +1583,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024*20
# create group with 20MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize), "--mode=777")
@@ -1512,7 +1592,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self.assertNotEqual(grouppath, None)
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname,
"--group_name", group, "--mode=777")
@@ -1558,7 +1638,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024*100
# create group with 100MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize), "--mode=777")
@@ -1567,7 +1647,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self.assertNotEqual(grouppath, None)
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname,
"--group_name", group, "--mode=777")
@@ -1612,7 +1692,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize))
@@ -1637,7 +1717,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024*5
# create group with 5MB quota
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group,
"--size", str(osize), "--mode=777")
@@ -1646,7 +1726,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
self.assertNotEqual(grouppath, None)
# create subvolume under the group
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname,
"--group_name", group, "--mode=777")
@@ -1695,7 +1775,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
subvolumegroups = []
#create subvolumegroups
- subvolumegroups = self._generate_random_group_name(3)
+ subvolumegroups = self._gen_subvol_grp_name(3)
for groupname in subvolumegroups:
self._fs_cmd("subvolumegroup", "create", self.volname, groupname)
@@ -1713,12 +1793,12 @@ class TestSubvolumeGroups(TestVolumesHelper):
subvolumegroups = []
#create subvolumegroup
- subvolumegroups = self._generate_random_group_name(3)
+ subvolumegroups = self._gen_subvol_grp_name(3)
for groupname in subvolumegroups:
self._fs_cmd("subvolumegroup", "create", self.volname, groupname)
# create subvolume and remove. This creates '_deleting' directory.
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
self._fs_cmd("subvolume", "rm", self.volname, subvolume)
@@ -1731,10 +1811,10 @@ class TestSubvolumeGroups(TestVolumesHelper):
# tests the 'fs subvolumegroup ls' command filters internal directories
# eg: '_deleting', '_nogroup', '_index', "_legacy"
- subvolumegroups = self._generate_random_group_name(3)
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolumegroups = self._gen_subvol_grp_name(3)
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
#create subvolumegroups
for groupname in subvolumegroups:
@@ -1789,7 +1869,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
group = "pinme"
self._fs_cmd("subvolumegroup", "create", self.volname, group)
self._fs_cmd("subvolumegroup", "pin", self.volname, group, "distributed", "True")
- subvolumes = self._generate_random_subvolume_name(50)
+ subvolumes = self._gen_subvol_name(50)
for subvolume in subvolumes:
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--group_name", group)
self._wait_distributed_subtrees(2 * 2, status=status, rank="all")
@@ -1803,7 +1883,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
def test_subvolume_group_rm_force(self):
# test removing non-existing subvolume group with --force
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
try:
self._fs_cmd("subvolumegroup", "rm", self.volname, group, "--force")
except CommandFailedError:
@@ -1812,7 +1892,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
def test_subvolume_group_exists_with_subvolumegroup_and_no_subvolume(self):
"""Test the presence of any subvolumegroup when only subvolumegroup is present"""
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
# create subvolumegroup
self._fs_cmd("subvolumegroup", "create", self.volname, group)
ret = self._fs_cmd("subvolumegroup", "exist", self.volname)
@@ -1832,8 +1912,8 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""Test the presence of any subvolume when subvolumegroup
and subvolume both are present"""
- group = self._generate_random_group_name()
- subvolume = self._generate_random_subvolume_name(2)
+ group = self._gen_subvol_grp_name()
+ subvolume = self._gen_subvol_name(2)
# create subvolumegroup
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# create subvolume in group
@@ -1859,7 +1939,7 @@ class TestSubvolumeGroups(TestVolumesHelper):
"""Test the presence of any subvolume when subvolume is present
but no subvolumegroup is present"""
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
ret = self._fs_cmd("subvolumegroup", "exist", self.volname)
@@ -1869,11 +1949,37 @@ class TestSubvolumeGroups(TestVolumesHelper):
ret = self._fs_cmd("subvolumegroup", "exist", self.volname)
self.assertEqual(ret.strip('\n'), "no subvolumegroup exists")
+ def test_subvolume_group_rm_when_its_not_empty(self):
+ group = self._gen_subvol_grp_name()
+ subvolume = self._gen_subvol_name()
+
+ # create subvolumegroup
+ self._fs_cmd("subvolumegroup", "create", self.volname, group)
+ # create subvolume in group
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--group_name", group)
+ # try, remove subvolume group
+ try:
+ self._fs_cmd("subvolumegroup", "rm", self.volname, group)
+ except CommandFailedError as ce:
+ self.assertEqual(ce.exitstatus, errno.ENOTEMPTY, "invalid error code on deleting "
+ "subvolumegroup when it is not empty")
+ else:
+ self.fail("expected the 'fs subvolumegroup rm' command to fail")
+
+ # delete subvolume
+ self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--group_name", group)
+
+ # delete subvolumegroup
+ self._fs_cmd("subvolumegroup", "rm", self.volname, group)
+
+ # verify trash dir is clean
+ self._wait_for_trash_empty()
+
class TestSubvolumes(TestVolumesHelper):
"""Tests for FS subvolume operations, except snapshot and snapshot clone."""
def test_async_subvolume_rm(self):
- subvolumes = self._generate_random_subvolume_name(100)
+ subvolumes = self._gen_subvol_name(100)
# create subvolumes
for subvolume in subvolumes:
@@ -1892,7 +1998,7 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty(timeout=300)
def test_default_uid_gid_subvolume(self):
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
expected_uid = 0
expected_gid = 0
@@ -1926,7 +2032,7 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_create_and_rm(self):
# create subvolume
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
# make sure it exists
@@ -1948,8 +2054,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_create_and_rm_in_group(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -1968,7 +2074,7 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_create_idempotence(self):
# create subvolume
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
# try creating w/ same subvolume name -- should be idempotent
@@ -1982,7 +2088,7 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_create_idempotence_resize(self):
# create subvolume
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
# try creating w/ same subvolume name with size -- should set quota
@@ -2003,7 +2109,7 @@ class TestSubvolumes(TestVolumesHelper):
default_mode = "755"
# create subvolume
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
subvol_path = self._get_subvolume_path(self.volname, subvolume)
@@ -2027,7 +2133,7 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_create_idempotence_without_passing_mode(self):
# create subvolume
desired_mode = "777"
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode", desired_mode)
subvol_path = self._get_subvolume_path(self.volname, subvolume)
@@ -2056,7 +2162,7 @@ class TestSubvolumes(TestVolumesHelper):
"""
# create subvolume
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--namespace-isolated")
# get subvolume metadata
@@ -2071,7 +2177,7 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_create_with_auto_cleanup_on_fail(self):
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
data_pool = "invalid_pool"
# create subvolume with invalid data pool layout fails
with self.assertRaises(CommandFailedError):
@@ -2089,8 +2195,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_create_with_desired_data_pool_layout_in_group(self):
- subvol1, subvol2 = self._generate_random_subvolume_name(2)
- group = self._generate_random_group_name()
+ subvol1, subvol2 = self._gen_subvol_name(2)
+ group = self._gen_subvol_grp_name()
# create group. this also helps set default pool layout for subvolumes
# created within the group.
@@ -2126,7 +2232,7 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_create_with_desired_mode(self):
- subvol1 = self._generate_random_subvolume_name()
+ subvol1 = self._gen_subvol_name()
# default mode
default_mode = "755"
@@ -2156,9 +2262,9 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_create_with_desired_mode_in_group(self):
- subvol1, subvol2, subvol3 = self._generate_random_subvolume_name(3)
+ subvol1, subvol2, subvol3 = self._gen_subvol_name(3)
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
# default mode
expected_mode1 = "755"
# desired mode
@@ -2202,7 +2308,7 @@ class TestSubvolumes(TestVolumesHelper):
gid = 1000
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--uid", str(uid), "--gid", str(gid))
# make sure it exists
@@ -2222,7 +2328,7 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_create_with_invalid_data_pool_layout(self):
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
data_pool = "invalid_pool"
# create subvolume with invalid data pool layout
try:
@@ -2237,7 +2343,7 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_create_with_invalid_size(self):
# create subvolume with an invalid size -1
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
try:
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--size", "-1")
except CommandFailedError as ce:
@@ -2254,7 +2360,7 @@ class TestSubvolumes(TestVolumesHelper):
permission denied error if option --group=_nogroup is provided.
"""
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
# try to create subvolume providing --group_name=_nogroup option
try:
@@ -2289,7 +2395,7 @@ class TestSubvolumes(TestVolumesHelper):
"""
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
osize = self.DEFAULT_FILE_SIZE*1024*1024
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize))
@@ -2319,7 +2425,7 @@ class TestSubvolumes(TestVolumesHelper):
"type", "uid", "features", "state"]
# create subvolume
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
# get subvolume metadata
@@ -2367,7 +2473,7 @@ class TestSubvolumes(TestVolumesHelper):
subvolumes = []
# create subvolumes
- subvolumes = self._generate_random_subvolume_name(3)
+ subvolumes = self._gen_subvol_name(3)
for subvolume in subvolumes:
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -2439,7 +2545,7 @@ class TestSubvolumes(TestVolumesHelper):
"""
ensure a subvolume is marked with the ceph.dir.subvolume xattr
"""
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -2475,7 +2581,7 @@ class TestSubvolumes(TestVolumesHelper):
self.fs.set_max_mds(2)
status = self.fs.wait_for_daemons()
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
self._fs_cmd("subvolume", "pin", self.volname, subvolume, "export", "1")
path = self._fs_cmd("subvolume", "getpath", self.volname, subvolume)
@@ -2493,8 +2599,8 @@ class TestSubvolumes(TestVolumesHelper):
### authorize operations
def test_authorize_deauthorize_legacy_subvolume(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
authid = "alice"
guest_mount = self.mount_b
@@ -2519,10 +2625,11 @@ class TestSubvolumes(TestVolumesHelper):
self.assertIn("client.{0}".format(authid), existing_ids)
# configure credentials for guest client
- self._configure_guest_auth(guest_mount, authid, key)
-
+ guest_keyring_path = self._configure_guest_auth(
+ guest_mount, authid, key)
# mount the subvolume, and write to it
- guest_mount.mount_wait(cephfs_mntpt=mount_path)
+ guest_mount.mount_wait(cephfs_mntpt=mount_path,
+ client_keyring_path=guest_keyring_path)
guest_mount.write_n_mb("data.bin", 1)
# authorize guest authID read access to subvolume
@@ -2551,8 +2658,8 @@ class TestSubvolumes(TestVolumesHelper):
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
def test_authorize_deauthorize_subvolume(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
authid = "alice"
guest_mount = self.mount_b
@@ -2575,10 +2682,11 @@ class TestSubvolumes(TestVolumesHelper):
self.assertIn("client.{0}".format(authid), existing_ids)
# configure credentials for guest client
- self._configure_guest_auth(guest_mount, authid, key)
-
+ guest_keyring_path = self._configure_guest_auth(
+ guest_mount, authid, key)
# mount the subvolume, and write to it
- guest_mount.mount_wait(cephfs_mntpt=mount_path)
+ guest_mount.mount_wait(cephfs_mntpt=mount_path,
+ client_keyring_path=guest_keyring_path)
guest_mount.write_n_mb("data.bin", 1)
# authorize guest authID read access to subvolume
@@ -2614,8 +2722,8 @@ class TestSubvolumes(TestVolumesHelper):
subvolumes is stored as a two-way mapping between auth
IDs and subvolumes that they're authorized to access.
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
guest_mount = self.mount_b
@@ -2722,8 +2830,8 @@ class TestSubvolumes(TestVolumesHelper):
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
def test_subvolume_authorized_list(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
authid1 = "alice"
authid2 = "guest1"
authid3 = "guest2"
@@ -2765,11 +2873,11 @@ class TestSubvolumes(TestVolumesHelper):
it's not allowed to authorize the auth-id by default.
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# Create auth_id
- self.fs.mon_manager.raw_cluster_cmd(
+ self.run_ceph_cmd(
"auth", "get-or-create", "client.guest1",
"mds", "allow *",
"osd", "allow rw",
@@ -2798,7 +2906,7 @@ class TestSubvolumes(TestVolumesHelper):
self.fail("expected the 'fs subvolume authorize' command to fail")
# clean up
- self.fs.mon_manager.raw_cluster_cmd("auth", "rm", "client.guest1")
+ self.run_ceph_cmd("auth", "rm", "client.guest1")
self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--group_name", group)
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
@@ -2809,11 +2917,11 @@ class TestSubvolumes(TestVolumesHelper):
allowed with option allow_existing_id.
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# Create auth_id
- self.fs.mon_manager.raw_cluster_cmd(
+ self.run_ceph_cmd(
"auth", "get-or-create", "client.guest1",
"mds", "allow *",
"osd", "allow rw",
@@ -2841,7 +2949,7 @@ class TestSubvolumes(TestVolumesHelper):
# clean up
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume, auth_id,
"--group_name", group)
- self.fs.mon_manager.raw_cluster_cmd("auth", "rm", "client.guest1")
+ self.run_ceph_cmd("auth", "rm", "client.guest1")
self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--group_name", group)
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
@@ -2852,8 +2960,8 @@ class TestSubvolumes(TestVolumesHelper):
deauthorize. It should only remove caps associated with it.
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
auth_id = "guest1"
guestclient_1 = {
@@ -2875,7 +2983,7 @@ class TestSubvolumes(TestVolumesHelper):
"--group_name", group).rstrip()
# Update caps for guestclient_1 out of band
- out = self.fs.mon_manager.raw_cluster_cmd(
+ out = self.get_ceph_cmd_stdout(
"auth", "caps", "client.guest1",
"mds", "allow rw path=/volumes/{0}, allow rw path={1}".format(group, subvol_path),
"osd", "allow rw pool=cephfs_data",
@@ -2888,7 +2996,7 @@ class TestSubvolumes(TestVolumesHelper):
# Validate the caps of guestclient_1 after deauthorize. It should not have deleted
# guestclient_1. The mgr and mds caps should be present which was updated out of band.
- out = json.loads(self.fs.mon_manager.raw_cluster_cmd("auth", "get", "client.guest1", "--format=json-pretty"))
+ out = json.loads(self.get_ceph_cmd_stdout("auth", "get", "client.guest1", "--format=json-pretty"))
self.assertEqual("client.guest1", out[0]["entity"])
self.assertEqual("allow rw path=/volumes/{0}".format(group), out[0]["caps"]["mds"])
@@ -2896,7 +3004,7 @@ class TestSubvolumes(TestVolumesHelper):
self.assertNotIn("osd", out[0]["caps"])
# clean up
- out = self.fs.mon_manager.raw_cluster_cmd("auth", "rm", "client.guest1")
+ out = self.get_ceph_cmd_stdout("auth", "rm", "client.guest1")
self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--group_name", group)
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
@@ -2909,8 +3017,8 @@ class TestSubvolumes(TestVolumesHelper):
guest_mount = self.mount_b
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
auth_id = "guest1"
guestclient_1 = {
@@ -2948,7 +3056,7 @@ class TestSubvolumes(TestVolumesHelper):
# clean up
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume, auth_id, "--group_name", group)
guest_mount.umount_wait()
- self.fs.mon_manager.raw_cluster_cmd("auth", "rm", "client.guest1")
+ self.run_ceph_cmd("auth", "rm", "client.guest1")
self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--group_name", group)
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
@@ -2961,8 +3069,8 @@ class TestSubvolumes(TestVolumesHelper):
guest_mount = self.mount_b
- subvolume1, subvolume2 = self._generate_random_subvolume_name(2)
- group = self._generate_random_group_name()
+ subvolume1, subvolume2 = self._gen_subvol_name(2)
+ group = self._gen_subvol_grp_name()
guestclient_1 = {
"auth_id": "guest1",
@@ -3004,7 +3112,7 @@ class TestSubvolumes(TestVolumesHelper):
# clean up
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume1, "guest1", "--group_name", group)
guest_mount.umount_wait()
- self.fs.mon_manager.raw_cluster_cmd("auth", "rm", "client.guest1")
+ self.run_ceph_cmd("auth", "rm", "client.guest1")
self._fs_cmd("subvolume", "rm", self.volname, subvolume1, "--group_name", group)
self._fs_cmd("subvolume", "rm", self.volname, subvolume2, "--group_name", group)
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
@@ -3019,8 +3127,8 @@ class TestSubvolumes(TestVolumesHelper):
guest_mount = self.mount_b
- subvolume1, subvolume2 = self._generate_random_subvolume_name(2)
- group = self._generate_random_group_name()
+ subvolume1, subvolume2 = self._gen_subvol_name(2)
+ group = self._gen_subvol_grp_name()
auth_id = "guest1"
guestclient_1 = {
@@ -3079,7 +3187,7 @@ class TestSubvolumes(TestVolumesHelper):
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume1, auth_id, "--group_name", group)
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume2, auth_id, "--group_name", group)
guest_mount.umount_wait()
- self.fs.mon_manager.raw_cluster_cmd("auth", "rm", "client.guest1")
+ self.run_ceph_cmd("auth", "rm", "client.guest1")
self._fs_cmd("subvolume", "rm", self.volname, subvolume1, "--group_name", group)
self._fs_cmd("subvolume", "rm", self.volname, subvolume2, "--group_name", group)
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
@@ -3094,8 +3202,8 @@ class TestSubvolumes(TestVolumesHelper):
guest_mount = self.mount_b
- subvolume1, subvolume2 = self._generate_random_subvolume_name(2)
- group = self._generate_random_group_name()
+ subvolume1, subvolume2 = self._gen_subvol_name(2)
+ group = self._gen_subvol_grp_name()
auth_id = "guest1"
guestclient_1 = {
@@ -3151,7 +3259,7 @@ class TestSubvolumes(TestVolumesHelper):
# clean up
self._fs_cmd("subvolume", "deauthorize", self.volname, subvolume1, auth_id, "--group_name", group)
guest_mount.umount_wait()
- self.fs.mon_manager.raw_cluster_cmd("auth", "rm", "client.guest1")
+ self.run_ceph_cmd("auth", "rm", "client.guest1")
self._fs_cmd("subvolume", "rm", self.volname, subvolume1, "--group_name", group)
self._fs_cmd("subvolume", "rm", self.volname, subvolume2, "--group_name", group)
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
@@ -3161,8 +3269,8 @@ class TestSubvolumes(TestVolumesHelper):
That a subvolume client can be evicted based on the auth ID
"""
- subvolumes = self._generate_random_subvolume_name(2)
- group = self._generate_random_group_name()
+ subvolumes = self._gen_subvol_name(2)
+ group = self._gen_subvol_grp_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3189,11 +3297,14 @@ class TestSubvolumes(TestVolumesHelper):
mount_path = self._fs_cmd("subvolume", "getpath", self.volname, subvolumes[i],
"--group_name", group).rstrip()
- # configure credentials for guest client
- self._configure_guest_auth(guest_mounts[i], auth_id, key)
+ # configure credentials for guest client
+ guest_keyring_path = self._configure_guest_auth(guest_mounts[i],
+ auth_id, key)
# mount the subvolume, and write to it
- guest_mounts[i].mount_wait(cephfs_mntpt=mount_path)
+ guest_mounts[i].mount_wait(
+ cephfs_mntpt=mount_path,
+ client_keyring_path=guest_keyring_path)
guest_mounts[i].write_n_mb("data.bin", 1)
# Evict client, guest_mounts[0], using auth ID 'guest' and has mounted
@@ -3230,7 +3341,7 @@ class TestSubvolumes(TestVolumesHelper):
self.fs.wait_for_daemons()
self.config_set('mds', 'mds_export_ephemeral_random', True)
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
self._fs_cmd("subvolume", "pin", self.volname, subvolume, "random", ".01")
# no verification
@@ -3248,7 +3359,7 @@ class TestSubvolumes(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize))
# make sure it exists
@@ -3281,7 +3392,7 @@ class TestSubvolumes(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize))
# make sure it exists
@@ -3315,7 +3426,7 @@ class TestSubvolumes(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024*20
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize), "--mode=777")
# make sure it exists
@@ -3362,7 +3473,7 @@ class TestSubvolumes(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024*20
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize), "--mode=777")
# make sure it exists
@@ -3410,7 +3521,7 @@ class TestSubvolumes(TestVolumesHelper):
osize = self.DEFAULT_FILE_SIZE*1024*1024*10
# create subvolume of quota 10MB and make sure it exists
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize), "--mode=777")
subvolpath = self._get_subvolume_path(self.volname, subvolname)
self.assertNotEqual(subvolpath, None)
@@ -3458,7 +3569,7 @@ class TestSubvolumes(TestVolumesHelper):
"""
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size",
str(self.DEFAULT_FILE_SIZE*1024*1024))
@@ -3485,7 +3596,7 @@ class TestSubvolumes(TestVolumesHelper):
"""
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size",
str(self.DEFAULT_FILE_SIZE*1024*1024*5), "--mode=777")
@@ -3522,7 +3633,7 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_rm_force(self):
# test removing non-existing subvolume with --force
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
try:
self._fs_cmd("subvolume", "rm", self.volname, subvolume, "--force")
except CommandFailedError:
@@ -3531,8 +3642,8 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_exists_with_subvolumegroup_and_subvolume(self):
"""Test the presence of any subvolume by specifying the name of subvolumegroup"""
- group = self._generate_random_group_name()
- subvolume1 = self._generate_random_subvolume_name()
+ group = self._gen_subvol_grp_name()
+ subvolume1 = self._gen_subvol_name()
# create subvolumegroup
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# create subvolume in group
@@ -3550,7 +3661,7 @@ class TestSubvolumes(TestVolumesHelper):
"""Test the presence of any subvolume specifying the name
of subvolumegroup and no subvolumes"""
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
# create subvolumegroup
self._fs_cmd("subvolumegroup", "create", self.volname, group)
ret = self._fs_cmd("subvolume", "exist", self.volname, "--group_name", group)
@@ -3562,7 +3673,7 @@ class TestSubvolumes(TestVolumesHelper):
"""Test the presence of any subvolume without specifying the name
of subvolumegroup"""
- subvolume1 = self._generate_random_subvolume_name()
+ subvolume1 = self._gen_subvol_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume1)
ret = self._fs_cmd("subvolume", "exist", self.volname)
@@ -3585,7 +3696,7 @@ class TestSubvolumes(TestVolumesHelper):
"""
# create subvolume
- subvolname = self._generate_random_subvolume_name()
+ subvolname = self._gen_subvol_name()
osize = self.DEFAULT_FILE_SIZE*1024*1024
self._fs_cmd("subvolume", "create", self.volname, subvolname, "--size", str(osize))
@@ -3614,8 +3725,8 @@ class TestSubvolumes(TestVolumesHelper):
is cleaned up. The subvolume deletion issued while the trash directory is not empty, should pass and should
not error out with EAGAIN.
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -3644,8 +3755,8 @@ class TestSubvolumes(TestVolumesHelper):
def test_subvolume_user_metadata_set(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3668,8 +3779,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_set_idempotence(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3698,8 +3809,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_get(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3731,8 +3842,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_get_for_nonexisting_key(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3761,8 +3872,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_get_for_nonexisting_section(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3786,8 +3897,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_update(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3823,8 +3934,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_list(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3856,8 +3967,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_list_if_no_metadata_set(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3885,8 +3996,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_remove(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3920,8 +4031,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_remove_for_nonexisting_key(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3950,8 +4061,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_remove_for_nonexisting_section(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -3975,8 +4086,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_remove_force(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4010,8 +4121,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_remove_force_for_nonexisting_key(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4051,8 +4162,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_set_and_get_for_legacy_subvolume(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# emulate a old-fashioned subvolume in a custom group
createpath = os.path.join(".", "volumes", group, subvolname)
@@ -4085,8 +4196,8 @@ class TestSubvolumes(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_user_metadata_list_and_remove_for_legacy_subvolume(self):
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# emulate a old-fashioned subvolume in a custom group
createpath = os.path.join(".", "volumes", group, subvolname)
@@ -4133,9 +4244,9 @@ class TestSubvolumeGroupSnapshots(TestVolumesHelper):
"""Tests for FS subvolume group snapshot operations."""
@unittest.skip("skipping subvolumegroup snapshot tests")
def test_nonexistent_subvolume_group_snapshot_rm(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4169,9 +4280,9 @@ class TestSubvolumeGroupSnapshots(TestVolumesHelper):
@unittest.skip("skipping subvolumegroup snapshot tests")
def test_subvolume_group_snapshot_create_and_rm(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4196,9 +4307,9 @@ class TestSubvolumeGroupSnapshots(TestVolumesHelper):
@unittest.skip("skipping subvolumegroup snapshot tests")
def test_subvolume_group_snapshot_idempotence(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4231,11 +4342,11 @@ class TestSubvolumeGroupSnapshots(TestVolumesHelper):
snapshots = []
# create group
- group = self._generate_random_group_name()
+ group = self._gen_subvol_grp_name()
self._fs_cmd("subvolumegroup", "create", self.volname, group)
# create subvolumegroup snapshots
- snapshots = self._generate_random_snapshot_name(3)
+ snapshots = self._gen_subvol_snap_name(3)
for snapshot in snapshots:
self._fs_cmd("subvolumegroup", "snapshot", "create", self.volname, group, snapshot)
@@ -4250,8 +4361,8 @@ class TestSubvolumeGroupSnapshots(TestVolumesHelper):
@unittest.skip("skipping subvolumegroup snapshot tests")
def test_subvolume_group_snapshot_rm_force(self):
# test removing non-existing subvolume group snapshot with --force
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# remove snapshot
try:
self._fs_cmd("subvolumegroup", "snapshot", "rm", self.volname, group, snapshot, "--force")
@@ -4259,8 +4370,8 @@ class TestSubvolumeGroupSnapshots(TestVolumesHelper):
raise RuntimeError("expected the 'fs subvolumegroup snapshot rm --force' command to succeed")
def test_subvolume_group_snapshot_unsupported_status(self):
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4280,8 +4391,8 @@ class TestSubvolumeGroupSnapshots(TestVolumesHelper):
class TestSubvolumeSnapshots(TestVolumesHelper):
"""Tests for FS subvolume snapshot operations."""
def test_nonexistent_subvolume_snapshot_rm(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4308,8 +4419,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_create_and_rm(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4327,8 +4438,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_create_idempotence(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4356,8 +4467,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
snap_md = ["created_at", "data_pool", "has_pending_clones"]
- subvolume = self._generate_random_subvolume_name()
- snapshot, snap_missing = self._generate_random_snapshot_name(2)
+ subvolume = self._gen_subvol_name()
+ snapshot, snap_missing = self._gen_subvol_snap_name(2)
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -4391,9 +4502,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_in_group(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4422,11 +4533,11 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
snapshots = []
# create subvolume
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
# create subvolume snapshots
- snapshots = self._generate_random_snapshot_name(3)
+ snapshots = self._gen_subvol_snap_name(3)
for snapshot in snapshots:
self._fs_cmd("subvolume", "snapshot", "create", self.volname, subvolume, snapshot)
@@ -4454,8 +4565,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
# at ancestral level
snapshots = []
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
snap_count = 3
# create group
@@ -4465,7 +4576,7 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--group_name", group)
# create subvolume snapshots
- snapshots = self._generate_random_snapshot_name(snap_count)
+ snapshots = self._gen_subvol_snap_name(snap_count)
for snapshot in snapshots:
self._fs_cmd("subvolume", "snapshot", "create", self.volname, subvolume, snapshot, group)
@@ -4500,8 +4611,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
at ancestral level
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4548,8 +4659,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
at ancestral level
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4596,9 +4707,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
fail.
"""
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- group_snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ group_snapshot = self._gen_subvol_snap_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -4637,8 +4748,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
ensure retained subvolume recreate does not leave any incarnations in the subvolume and trash
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4683,8 +4794,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
snap_md = ["created_at", "data_pool", "has_pending_clones"]
- subvolume = self._generate_random_subvolume_name()
- snapshot1, snapshot2 = self._generate_random_snapshot_name(2)
+ subvolume = self._gen_subvol_name()
+ snapshot1, snapshot2 = self._gen_subvol_snap_name(2)
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4746,8 +4857,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
snap_md = ["created_at", "data_pool", "has_pending_clones"]
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4840,7 +4951,7 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
ensure retain snapshots based delete of a subvolume with no snapshots, deletes the subbvolume
"""
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4859,8 +4970,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
ensure retained subvolume recreate fails if its trash is not yet purged
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4898,8 +5009,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_rm_with_snapshots(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -4930,9 +5041,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
Snapshot protect/unprotect commands are deprecated. This test exists to ensure that
invoking the command does not cause errors, till they are removed from a subsequent release.
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -4970,8 +5081,8 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
def test_subvolume_snapshot_rm_force(self):
# test removing non existing subvolume snapshot with --force
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# remove snapshot
try:
@@ -4983,9 +5094,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Set custom metadata for subvolume snapshot.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5015,9 +5126,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Set custom metadata for subvolume snapshot (Idempotency).
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5065,9 +5176,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Get custom metadata for a specified key in subvolume snapshot metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5106,9 +5217,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Get custom metadata for subvolume snapshot if specified key not exist in metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5144,9 +5255,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Get custom metadata for subvolume snapshot if metadata is not added for subvolume snapshot.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5177,9 +5288,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Update custom metadata for a specified key in subvolume snapshot metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5222,9 +5333,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
List custom metadata for subvolume snapshot.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5261,9 +5372,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
List custom metadata for subvolume snapshot if metadata is not added for subvolume snapshot.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5295,9 +5406,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Remove custom metadata for a specified key in subvolume snapshot metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5338,9 +5449,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Remove custom metadata for subvolume snapshot if specified key not exist in metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5376,9 +5487,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Remove custom metadata for subvolume snapshot if metadata is not added for subvolume snapshot.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5409,9 +5520,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Forcefully remove custom metadata for a specified key in subvolume snapshot metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5452,9 +5563,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Forcefully remove custom metadata for subvolume snapshot if specified key not exist in metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5501,9 +5612,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Verify metadata removal of subvolume snapshot after snapshot removal.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5533,9 +5644,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
# try to get metadata after removing snapshot.
# Expecting error ENOENT with error message of snapshot does not exist
- cmd_ret = self.mgr_cluster.mon_manager.run_cluster_cmd(
- args=["fs", "subvolume", "snapshot", "metadata", "get", self.volname, subvolname, snapshot, key, group],
- check_status=False, stdout=StringIO(), stderr=StringIO())
+ cmd_ret = self.run_ceph_cmd(
+ args=["fs", "subvolume", "snapshot", "metadata", "get", self.volname, subvolname, snapshot, key, group], check_status=False, stdout=StringIO(),
+ stderr=StringIO())
self.assertEqual(cmd_ret.returncode, errno.ENOENT, "Expecting ENOENT error")
self.assertIn(f"snapshot '{snapshot}' does not exist", cmd_ret.stderr.getvalue(),
f"Expecting message: snapshot '{snapshot}' does not exist ")
@@ -5561,9 +5672,9 @@ class TestSubvolumeSnapshots(TestVolumesHelper):
"""
Validate cleaning of stale subvolume snapshot metadata.
"""
- subvolname = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolname = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
# create group.
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5628,9 +5739,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"data_pool", "gid", "mode", "mon_addrs", "mtime", "path", "pool_namespace",
"type", "uid"]
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -5672,8 +5783,8 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
If no clone is performed then path /volumes/_index/clone/{track_id}
will not exist.
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume.
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -5700,10 +5811,13 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
Verify subvolume snapshot info output if no clone is in pending state.
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
clone_list = [f'clone_{i}' for i in range(3)]
+ # disable "capped" clones
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_no_wait', False)
+
# create subvolume.
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -5741,8 +5855,8 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
Clones are not specified for particular target_group. Hence target_group
should not be in the output as we don't show _nogroup (default group)
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
clone_list = [f'clone_{i}' for i in range(3)]
# create subvolume.
@@ -5754,6 +5868,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
# insert delay at the beginning of snapshot clone
self.config_set('mgr', 'mgr/volumes/snapshot_clone_delay', 5)
+ # disable "capped" clones
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_no_wait', False)
+
# schedule a clones
for clone in clone_list:
self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone)
@@ -5788,11 +5905,11 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
Verify subvolume snapshot info output if clones are in pending state.
Clones are not specified for target_group.
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
- group = self._generate_random_group_name()
- target_group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
+ group = self._gen_subvol_grp_name()
+ target_group = self._gen_subvol_grp_name()
# create groups
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -5844,8 +5961,8 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
Orphan clones should not list under pending clones.
orphan_clones_count should display correct count of orphan clones'
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
clone_list = [f'clone_{i}' for i in range(3)]
# create subvolume.
@@ -5857,6 +5974,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
# insert delay at the beginning of snapshot clone
self.config_set('mgr', 'mgr/volumes/snapshot_clone_delay', 15)
+ # disable "capped" clones
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_no_wait', False)
+
# schedule a clones
for clone in clone_list:
self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone)
@@ -5891,7 +6011,7 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self.assertEqual(res['has_pending_clones'], "no")
def test_non_clone_status(self):
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -5911,9 +6031,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_clone_inherit_snapshot_namespace_and_size(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
osize = self.DEFAULT_FILE_SIZE*1024*1024*12
# create subvolume, in an isolated namespace with a specified size
@@ -5955,9 +6075,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_clone_inherit_quota_attrs(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
osize = self.DEFAULT_FILE_SIZE*1024*1024*12
# create subvolume with a specified size
@@ -6003,9 +6123,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_clone_in_progress_getpath(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6052,9 +6172,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_clone_in_progress_snapshot_rm(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6100,9 +6220,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_clone_in_progress_source(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6151,9 +6271,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
retain snapshots of a cloned subvolume and check disallowed operations
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot1, snapshot2 = self._generate_random_snapshot_name(2)
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot1, snapshot2 = self._gen_subvol_snap_name(2)
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6225,9 +6345,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
clone a snapshot from a snapshot retained subvolume
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6270,9 +6390,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
clone a subvolume from recreated subvolume's latest snapshot
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot1, snapshot2 = self._generate_random_snapshot_name(2)
- clone = self._generate_random_clone_name(1)
+ subvolume = self._gen_subvol_name()
+ snapshot1, snapshot2 = self._gen_subvol_snap_name(2)
+ clone = self._gen_subvol_clone_name(1)
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6328,8 +6448,8 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
recreate a subvolume from one of its retained snapshots
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6372,9 +6492,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
ensure retained clone recreate fails if its trash is not yet purged
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume)
@@ -6426,9 +6546,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_attr_clone(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6462,9 +6582,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
ensure failure status is not shown when clone is not in failed/cancelled state
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone1 = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1 = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6528,9 +6648,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
ensure failure status is shown when clone is in failed state and validate the reason
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone1 = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1 = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6573,9 +6693,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
ensure failure status is shown when clone is cancelled during pending state and validate the reason
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone1 = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1 = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6617,9 +6737,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
"""
ensure failure status is shown when clone is cancelled during in-progress state and validate the reason
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone1 = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1 = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6661,9 +6781,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6694,9 +6814,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_quota_exceeded(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume with 20MB quota
osize = self.DEFAULT_FILE_SIZE*1024*1024*20
@@ -6738,9 +6858,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
'complete|cancelled|failed' states. It fails with EAGAIN in any other states.
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6785,9 +6905,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_retain_suid_guid(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6827,9 +6947,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_and_reclone(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone1, clone2 = self._generate_random_clone_name(2)
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1, clone2 = self._gen_subvol_clone_name(2)
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6880,9 +7000,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_cancel_in_progress(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6931,9 +7051,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
# yeh, 1gig -- we need the clone to run for sometime
FILE_SIZE_MB = 1024
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clones = self._generate_random_clone_name(NR_CLONES)
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clones = self._gen_subvol_snap_name(NR_CLONES)
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -6944,6 +7064,11 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
# snapshot subvolume
self._fs_cmd("subvolume", "snapshot", "create", self.volname, subvolume, snapshot)
+ # Disable the snapshot_clone_no_wait config option
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_no_wait', False)
+ threads_available = self.config_get('mgr', 'mgr/volumes/snapshot_clone_no_wait')
+ self.assertEqual(threads_available, 'false')
+
# schedule clones
for clone in clones:
self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone)
@@ -6983,10 +7108,10 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_different_groups(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
- s_group, c_group = self._generate_random_group_name(2)
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
+ s_group, c_group = self._gen_subvol_grp_name(2)
# create groups
self._fs_cmd("subvolumegroup", "create", self.volname, s_group)
@@ -7026,9 +7151,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_fail_with_remove(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone1, clone2 = self._generate_random_clone_name(2)
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1, clone2 = self._gen_subvol_clone_name(2)
pool_capacity = 32 * 1024 * 1024
# number of files required to fill up 99% of the pool
@@ -7047,8 +7172,8 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
new_pool = "new_pool"
self.fs.add_data_pool(new_pool)
- self.fs.mon_manager.raw_cluster_cmd("osd", "pool", "set-quota", new_pool,
- "max_bytes", "{0}".format(pool_capacity // 4))
+ self.run_ceph_cmd("osd", "pool", "set-quota", new_pool,
+ "max_bytes", f"{pool_capacity // 4}")
# schedule a clone
self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone1, "--pool_layout", new_pool)
@@ -7089,9 +7214,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_on_existing_subvolumes(self):
- subvolume1, subvolume2 = self._generate_random_subvolume_name(2)
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume1, subvolume2 = self._gen_subvol_name(2)
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create subvolumes
self._fs_cmd("subvolume", "create", self.volname, subvolume1, "--mode=777")
@@ -7141,9 +7266,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_pool_layout(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# add data pool
new_pool = "new_pool"
@@ -7185,10 +7310,10 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_under_group(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
- group = self._generate_random_group_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
+ group = self._gen_subvol_grp_name()
# create subvolume
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
@@ -7225,9 +7350,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self._wait_for_trash_empty()
def test_subvolume_snapshot_clone_with_attrs(self):
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
mode = "777"
uid = "1000"
@@ -7274,9 +7399,9 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
and verify clone operation.
further ensure that a legacy volume is not updated to v2, but clone is.
"""
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# emulate a old-fashioned subvolume
createpath = os.path.join(".", "volumes", "_nogroup", subvolume)
@@ -7367,10 +7492,10 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
self.assertEqual(max_concurrent_clones, 2)
def test_subvolume_under_group_snapshot_clone(self):
- subvolume = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
- snapshot = self._generate_random_snapshot_name()
- clone = self._generate_random_clone_name()
+ subvolume = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone = self._gen_subvol_clone_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)
@@ -7406,6 +7531,159 @@ class TestSubvolumeSnapshotClones(TestVolumesHelper):
# verify trash dir is clean
self._wait_for_trash_empty()
+ def test_subvolume_snapshot_clone_with_no_wait_enabled(self):
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1, clone2, clone3 = self._gen_subvol_clone_name(3)
+
+ # create subvolume
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
+
+ # do some IO
+ self._do_subvolume_io(subvolume, number_of_files=10)
+
+ # snapshot subvolume
+ self._fs_cmd("subvolume", "snapshot", "create", self.volname, subvolume, snapshot)
+
+ # Decrease number of cloner threads
+ self.config_set('mgr', 'mgr/volumes/max_concurrent_clones', 2)
+ max_concurrent_clones = int(self.config_get('mgr', 'mgr/volumes/max_concurrent_clones'))
+ self.assertEqual(max_concurrent_clones, 2)
+
+ # Enable the snapshot_clone_no_wait config option
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_no_wait', True)
+ threads_available = self.config_get('mgr', 'mgr/volumes/snapshot_clone_no_wait')
+ self.assertEqual(threads_available, 'true')
+
+ # Insert delay of 15 seconds at the beginning of the snapshot clone
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_delay', 15)
+
+ # schedule a clone1
+ self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone1)
+
+ # schedule a clone2
+ self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone2)
+
+ # schedule a clone3
+ cmd_ret = self.mgr_cluster.mon_manager.run_cluster_cmd(
+ args=["fs", "subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone3], check_status=False, stdout=StringIO(),
+ stderr=StringIO())
+ self.assertEqual(cmd_ret.returncode, errno.EAGAIN, "Expecting EAGAIN error")
+
+ # check clone1 status
+ self._wait_for_clone_to_complete(clone1)
+
+ # verify clone1
+ self._verify_clone(subvolume, snapshot, clone1)
+
+ # check clone2 status
+ self._wait_for_clone_to_complete(clone2)
+
+ # verify clone2
+ self._verify_clone(subvolume, snapshot, clone2)
+
+ # schedule clone3 , it should be successful this time
+ self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone3)
+
+ # check clone3 status
+ self._wait_for_clone_to_complete(clone3)
+
+ # verify clone3
+ self._verify_clone(subvolume, snapshot, clone3)
+
+ # set number of cloner threads to default
+ self.config_set('mgr', 'mgr/volumes/max_concurrent_clones', 4)
+ max_concurrent_clones = int(self.config_get('mgr', 'mgr/volumes/max_concurrent_clones'))
+ self.assertEqual(max_concurrent_clones, 4)
+
+ # set the snapshot_clone_delay to default
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_delay', 0)
+
+ # remove snapshot
+ self._fs_cmd("subvolume", "snapshot", "rm", self.volname, subvolume, snapshot)
+
+ # remove subvolumes
+ self._fs_cmd("subvolume", "rm", self.volname, subvolume)
+ self._fs_cmd("subvolume", "rm", self.volname, clone1)
+ self._fs_cmd("subvolume", "rm", self.volname, clone2)
+ self._fs_cmd("subvolume", "rm", self.volname, clone3)
+
+ # verify trash dir is clean
+ self._wait_for_trash_empty()
+
+ def test_subvolume_snapshot_clone_with_no_wait_not_enabled(self):
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1, clone2, clone3 = self._gen_subvol_clone_name(3)
+
+ # create subvolume
+ self._fs_cmd("subvolume", "create", self.volname, subvolume, "--mode=777")
+
+ # do some IO
+ self._do_subvolume_io(subvolume, number_of_files=10)
+
+ # snapshot subvolume
+ self._fs_cmd("subvolume", "snapshot", "create", self.volname, subvolume, snapshot)
+
+ # Disable the snapshot_clone_no_wait config option
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_no_wait', False)
+ threads_available = self.config_get('mgr', 'mgr/volumes/snapshot_clone_no_wait')
+ self.assertEqual(threads_available, 'false')
+
+ # Decrease number of cloner threads
+ self.config_set('mgr', 'mgr/volumes/max_concurrent_clones', 2)
+ max_concurrent_clones = int(self.config_get('mgr', 'mgr/volumes/max_concurrent_clones'))
+ self.assertEqual(max_concurrent_clones, 2)
+
+ # schedule a clone1
+ self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone1)
+
+ # schedule a clone2
+ self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone2)
+
+ # schedule a clone3
+ self._fs_cmd("subvolume", "snapshot", "clone", self.volname, subvolume, snapshot, clone3)
+
+ # check clone1 status
+ self._wait_for_clone_to_complete(clone1)
+
+ # verify clone1
+ self._verify_clone(subvolume, snapshot, clone1)
+
+ # check clone2 status
+ self._wait_for_clone_to_complete(clone2)
+
+ # verify clone2
+ self._verify_clone(subvolume, snapshot, clone2)
+
+ # check clone3 status
+ self._wait_for_clone_to_complete(clone3)
+
+ # verify clone3
+ self._verify_clone(subvolume, snapshot, clone3)
+
+ # set the snapshot_clone_no_wait config option to default
+ self.config_set('mgr', 'mgr/volumes/snapshot_clone_no_wait', True)
+ threads_available = self.config_get('mgr', 'mgr/volumes/snapshot_clone_no_wait')
+ self.assertEqual(threads_available, 'true')
+
+ # set number of cloner threads to default
+ self.config_set('mgr', 'mgr/volumes/max_concurrent_clones', 4)
+ max_concurrent_clones = int(self.config_get('mgr', 'mgr/volumes/max_concurrent_clones'))
+ self.assertEqual(max_concurrent_clones, 4)
+
+ # remove snapshot
+ self._fs_cmd("subvolume", "snapshot", "rm", self.volname, subvolume, snapshot)
+
+ # remove subvolumes
+ self._fs_cmd("subvolume", "rm", self.volname, subvolume)
+ self._fs_cmd("subvolume", "rm", self.volname, clone1)
+ self._fs_cmd("subvolume", "rm", self.volname, clone2)
+ self._fs_cmd("subvolume", "rm", self.volname, clone3)
+
+ # verify trash dir is clean
+ self._wait_for_trash_empty()
+
class TestMisc(TestVolumesHelper):
"""Miscellaneous tests related to FS volume, subvolume group, and subvolume operations."""
@@ -7417,7 +7695,7 @@ class TestMisc(TestVolumesHelper):
self.assertLessEqual(len(sessions), 1) # maybe mgr is already mounted
# Get the mgr to definitely mount cephfs
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
sessions = self._session_list()
self.assertEqual(len(sessions), 1)
@@ -7433,7 +7711,7 @@ class TestMisc(TestVolumesHelper):
self.assertLessEqual(len(sessions), 1) # maybe mgr is already mounted
# Get the mgr to definitely mount cephfs
- subvolume = self._generate_random_subvolume_name()
+ subvolume = self._gen_subvol_name()
self._fs_cmd("subvolume", "create", self.volname, subvolume)
sessions = self._session_list()
self.assertEqual(len(sessions), 1)
@@ -7537,8 +7815,8 @@ class TestMisc(TestVolumesHelper):
accessible.
further ensure that a legacy volume is not updated to v2.
"""
- subvolume1, subvolume2 = self._generate_random_subvolume_name(2)
- group = self._generate_random_group_name()
+ subvolume1, subvolume2 = self._gen_subvol_name(2)
+ group = self._gen_subvol_grp_name()
# emulate a old-fashioned subvolume -- one in the default group and
# the other in a custom group
@@ -7588,9 +7866,9 @@ class TestMisc(TestVolumesHelper):
"type", "uid", "features", "state"]
snap_md = ["created_at", "data_pool", "has_pending_clones"]
- subvolume = self._generate_random_subvolume_name()
- snapshot = self._generate_random_snapshot_name()
- clone1, clone2 = self._generate_random_clone_name(2)
+ subvolume = self._gen_subvol_name()
+ snapshot = self._gen_subvol_snap_name()
+ clone1, clone2 = self._gen_subvol_clone_name(2)
mode = "777"
uid = "1000"
gid = "1000"
@@ -7695,8 +7973,8 @@ class TestMisc(TestVolumesHelper):
poor man's upgrade test -- theme continues...
ensure v1 to v2 upgrades are not done automatically due to various states of v1
"""
- subvolume1, subvolume2, subvolume3 = self._generate_random_subvolume_name(3)
- group = self._generate_random_group_name()
+ subvolume1, subvolume2, subvolume3 = self._gen_subvol_name(3)
+ group = self._gen_subvol_grp_name()
# emulate a v1 subvolume -- in the default group
subvol1_path = self._create_v1_subvolume(subvolume1)
@@ -7753,8 +8031,8 @@ class TestMisc(TestVolumesHelper):
poor man's upgrade test -- theme continues...
ensure v1 to v2 upgrades work
"""
- subvolume1, subvolume2 = self._generate_random_subvolume_name(2)
- group = self._generate_random_group_name()
+ subvolume1, subvolume2 = self._gen_subvol_name(2)
+ group = self._gen_subvol_grp_name()
# emulate a v1 subvolume -- in the default group
subvol1_path = self._create_v1_subvolume(subvolume1, has_snapshot=False)
@@ -7786,7 +8064,7 @@ class TestMisc(TestVolumesHelper):
on legacy subvol upgrade to v1
poor man's upgrade test -- theme continues...
"""
- subvol1, subvol2 = self._generate_random_subvolume_name(2)
+ subvol1, subvol2 = self._gen_subvol_name(2)
# emulate a old-fashioned subvolume in the default group
createpath1 = os.path.join(".", "volumes", "_nogroup", subvol1)
@@ -7822,7 +8100,7 @@ class TestMisc(TestVolumesHelper):
self._fs_cmd("subvolume", "authorize", self.volname, subvol1, authid1)
# Validate that the mds path added is of subvol1 and not of subvol2
- out = json.loads(self.fs.mon_manager.raw_cluster_cmd("auth", "get", "client.alice", "--format=json-pretty"))
+ out = json.loads(self.get_ceph_cmd_stdout("auth", "get", "client.alice", "--format=json-pretty"))
self.assertEqual("client.alice", out[0]["entity"])
self.assertEqual("allow rw path={0}".format(createpath1[1:]), out[0]["caps"]["mds"])
@@ -7839,8 +8117,8 @@ class TestMisc(TestVolumesHelper):
on legacy subvol upgrade to v1
poor man's upgrade test -- theme continues...
"""
- subvol = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvol = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# emulate a old-fashioned subvolume -- in a custom group
createpath = os.path.join(".", "volumes", group, subvol)
@@ -7882,8 +8160,8 @@ class TestMisc(TestVolumesHelper):
on legacy subvol upgrade to v1
poor man's upgrade test -- theme continues...
"""
- subvol = self._generate_random_subvolume_name()
- group = self._generate_random_group_name()
+ subvol = self._gen_subvol_name()
+ group = self._gen_subvol_grp_name()
# emulate a old-fashioned subvolume -- in a custom group
createpath = os.path.join(".", "volumes", group, subvol)
@@ -7926,8 +8204,8 @@ class TestPerModuleFinsherThread(TestVolumesHelper):
as four subvolume cmds are run
"""
def test_volumes_module_finisher_thread(self):
- subvol1, subvol2, subvol3 = self._generate_random_subvolume_name(3)
- group = self._generate_random_group_name()
+ subvol1, subvol2, subvol3 = self._gen_subvol_name(3)
+ group = self._gen_subvol_grp_name()
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group)