Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.1-cephfs] Adding Link Ops for ref inode tests #4533

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions tests/cephfs/cephfs_utilsV1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,8 @@ def kernel_mount(self, kernel_clients, mount_point, mon_node_ip, **kwargs):
kernel_cmd = (
f"mount -t ceph {mon_node_ip}:{kwargs.get('sub_dir', '/')} {mount_point} "
f"-o name={kwargs.get('new_client_hostname', client.node.hostname)},"
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret"
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret,"
f"noshare"
)

if kwargs.get("extra_params"):
Expand Down Expand Up @@ -1086,7 +1087,8 @@ def kernel_mount(self, kernel_clients, mount_point, mon_node_ip, **kwargs):
fstab_entry = (
f"{mon_node_ip}:{kwargs.get('sub_dir', '/')} {mount_point} ceph "
f"name={kwargs.get('new_client_hostname', client.node.hostname)},"
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret"
f"secretfile=/etc/ceph/{kwargs.get('new_client_hostname', client.node.hostname)}.secret,"
f"noshare"
)
if kwargs.get("extra_params"):
fstab_entry += f"{kwargs.get('extra_params')}"
Expand Down Expand Up @@ -1194,6 +1196,7 @@ def get_all_subvolumes(self, client, fs_list):
return subvolumes

@function_execution_time
@retry(CommandFailed, tries=5, delay=20)
def create_nfs(self, client, nfs_cluster_name, validate=True, **kwargs):
"""
Create an NFS cluster with the given parameters.
Expand All @@ -1216,11 +1219,15 @@ def create_nfs(self, client, nfs_cluster_name, validate=True, **kwargs):
)
if validate:
out, rc = client.exec_command(sudo=True, cmd="ceph nfs cluster ls")
nfscluster_ls = out.split("\n")
if nfs_cluster_name not in nfscluster_ls:
raise CommandFailed(
f"Creation of NFS cluster: {nfs_cluster_name} failed"
)
try:
nfs_clusters = json.loads(out.strip()) # Ensure proper JSON parsing
except json.JSONDecodeError:
log.error(f"Failed to parse NFS cluster list output: {out.strip()}")
raise CommandFailed("Invalid JSON output from 'ceph nfs cluster ls'")

if nfs_cluster_name not in nfs_clusters:
raise CommandFailed(f"Creation of NFS cluster: {nfs_cluster_name} failed")

return cmd_out, cmd_rc

@function_execution_time
Expand Down
Loading