@@ -1055,7 +1055,8 @@ def kernel_mount(self, kernel_clients, mount_point, mon_node_ip, **kwargs):
1055
1055
kernel_cmd = (
1056
1056
f"mount -t ceph { mon_node_ip } :{ kwargs .get ('sub_dir' , '/' )} { mount_point } "
1057
1057
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"
1059
1060
)
1060
1061
1061
1062
if kwargs .get ("extra_params" ):
@@ -1086,7 +1087,8 @@ def kernel_mount(self, kernel_clients, mount_point, mon_node_ip, **kwargs):
1086
1087
fstab_entry = (
1087
1088
f"{ mon_node_ip } :{ kwargs .get ('sub_dir' , '/' )} { mount_point } ceph "
1088
1089
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"
1090
1092
)
1091
1093
if kwargs .get ("extra_params" ):
1092
1094
fstab_entry += f"{ kwargs .get ('extra_params' )} "
@@ -1194,6 +1196,7 @@ def get_all_subvolumes(self, client, fs_list):
1194
1196
return subvolumes
1195
1197
1196
1198
@function_execution_time
1199
+ @retry (CommandFailed , tries = 5 , delay = 20 )
1197
1200
def create_nfs (self , client , nfs_cluster_name , validate = True , ** kwargs ):
1198
1201
"""
1199
1202
Create an NFS cluster with the given parameters.
@@ -1216,11 +1219,15 @@ def create_nfs(self, client, nfs_cluster_name, validate=True, **kwargs):
1216
1219
)
1217
1220
if validate :
1218
1221
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
+
1224
1231
return cmd_out , cmd_rc
1225
1232
1226
1233
@function_execution_time
0 commit comments