Issue Minor mount timeout fixes: do not use `retry/timeo` options for SMB, do not use `timeo` option for Lustre
@@ -47,7 +47,6 @@ S3_PROVIDER = 'S3'
READ_ONLY_MOUNT_OPT = 'ro'
MOUNT_LIMITS_NONE = 'none'
-
class PermissionHelper:
def __init__(self):
@@ -586,21 +585,27 @@ class NFSMounter(StorageMounter):
mount_options = file_mode_options
else:
mount_options += ',' + file_mode_options
-
- mount_timeo = os.getenv('CP_FS_MOUNT_TIMEOUT', 7)
- mount_retry = os.getenv('CP_FS_MOUNT_ATTEMPT', 0)
- if mount_options:
- if "timeo" not in mount_options:
- mount_options += ',timeo={}'.format(mount_timeo)
- if "retry" not in mount_options:
- mount_options += ',retry={}'.format(mount_retry)
- else:
- mount_options = 'timeo={timeo},retry={retry}'.format(timeo=mount_timeo, retry=mount_retry)
+ mount_options = self.append_timeout_options(mount_options)
command += ' -o {mount_option} {path} {mount}'.format(mount_option=mount_options, **params)
if PermissionHelper.is_storage_writable(self.storage):
command += ' && chmod {permission} {mount}'.format(permission=permission, **params)
return command
+ def append_timeout_options(self, mount_options):
+ if self.share_mount.mount_type == 'SMB':
+ return mount_options
+ if not mount_options or 'retry' not in mount_options:
+ mount_retry = os.getenv('CP_FS_MOUNT_ATTEMPT', 0)
+ retry_option = 'retry={}'.format(mount_retry)
+ mount_options = retry_option if not mount_options else mount_options + ',' + retry_option
+ if self.share_mount.mount_type == 'LUSTRE':
+ return mount_options
+ if not mount_options or 'timeo' not in mount_options:
+ mount_timeo = os.getenv('CP_FS_MOUNT_TIMEOUT', 7)
+ timeo_option = 'timeo={}'.format(mount_timeo)
+ mount_options = timeo_option if not mount_options else mount_options + ',' + timeo_option
+ return mount_options
+
def main():
parser = argparse.ArgumentParser()
