Skip to content

Commit ca90bed

Browse files
committed
[8.1-cephfs] Adding Link Ops for ref inode tests
Signed-off-by: hkadam134 <[email protected]>
1 parent 49d5d41 commit ca90bed

File tree

4 files changed

+1759
-7
lines changed

4 files changed

+1759
-7
lines changed

tests/cephfs/cephfs_utilsV1.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,8 @@ def kernel_mount(self, kernel_clients, mount_point, mon_node_ip, **kwargs):
10551055
kernel_cmd = (
10561056
f"mount -t ceph {mon_node_ip}:{kwargs.get('sub_dir', '/')} {mount_point} "
10571057
f"-o name={kwargs.get('new_client_hostname', client.node.hostname)},"
1058-
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret"
1058+
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret,"
1059+
f"noshare"
10591060
)
10601061

10611062
if kwargs.get("extra_params"):
@@ -1086,7 +1087,8 @@ def kernel_mount(self, kernel_clients, mount_point, mon_node_ip, **kwargs):
10861087
fstab_entry = (
10871088
f"{mon_node_ip}:{kwargs.get('sub_dir', '/')} {mount_point} ceph "
10881089
f"name={kwargs.get('new_client_hostname', client.node.hostname)},"
1089-
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret"
1090+
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret,"
1091+
f"noshare"
10901092
)
10911093
if kwargs.get("extra_params"):
10921094
fstab_entry += f"{kwargs.get('extra_params')}"
@@ -1194,6 +1196,7 @@ def get_all_subvolumes(self, client, fs_list):
11941196
return subvolumes
11951197

11961198
@function_execution_time
1199+
@retry(CommandFailed, tries=5, delay=20)
11971200
def create_nfs(self, client, nfs_cluster_name, validate=True, **kwargs):
11981201
"""
11991202
Create an NFS cluster with the given parameters.
@@ -1216,11 +1219,15 @@ def create_nfs(self, client, nfs_cluster_name, validate=True, **kwargs):
12161219
)
12171220
if validate:
12181221
out, rc = client.exec_command(sudo=True, cmd="ceph nfs cluster ls")
1219-
nfscluster_ls = out.split("\n")
1220-
if nfs_cluster_name not in nfscluster_ls:
1221-
raise CommandFailed(
1222-
f"Creation of NFS cluster: {nfs_cluster_name} failed"
1223-
)
1222+
try:
1223+
nfs_clusters = json.loads(out.strip()) # Ensure proper JSON parsing
1224+
except json.JSONDecodeError:
1225+
log.error(f"Failed to parse NFS cluster list output: {out.strip()}")
1226+
raise CommandFailed("Invalid JSON output from 'ceph nfs cluster ls'")
1227+
1228+
if nfs_cluster_name not in nfs_clusters:
1229+
raise CommandFailed(f"Creation of NFS cluster: {nfs_cluster_name} failed")
1230+
12241231
return cmd_out, cmd_rc
12251232

12261233
@function_execution_time

0 commit comments

Comments
 (0)