Forum: CFEngine Help
Subject: NFS mount timeout
Author: ro
Link to topic: https://cfengine.com/forum/read.php?3,27327,27327#msg-27327
Hi,
how to gracefully timeout mounts?
Cfengine tries to mount non-reachable NFS mounts by all means, significantly
delaying each run (which sometimes get piled up because of the delays).
Below is a universal method that does all the mounting stuff:
bundle agent nfs_mount(server,nfs_remote_dir,mountpoint) {
vars:
any::
"mount_options" slist => {
"rw",
"hard",
"intr"
};
"fstab_lines" slist => {
"$(server):$(nfs_remote_dir) $(mountpoint) nfs4
rw,hard,intr 0 0"
};
files:
any::
"$(mountpoint)/."
create => "true",
comment => "Create the mountpoint",
classes =>
if_repaired("repaired_nfs_mount_$(mountpoint)");
"$(sys.fstab)"
edit_line =>
insert_lines("@(nfs_mount.fstab_lines)"),
comment => "Add the mountpoint to the fstab",
classes =>
if_repaired("repaired_nfs_mount_$(mountpoint)");
storage:
any::
"$(mountpoint)"
mount =>
nfs_p("$(server)","$(nfs_remote_dir)","@(mount_options)"),
comment => "Mount the NFS share if necessary",
classes =>
if_repaired("repaired_nfs_mount_$(mountpoint)");
reports:
BC_BASE::
"Repaired method nfs_mount. Mounted '$(mountpoint)'."
ifvarclass =>
canonify("repaired_nfs_mount_$(mountpoint)");
BC_BASE::
"WARNING: Repair of method nfs_mount FAILED! '$(mountpoint)'
not mounted."
ifvarclass =>
canonify("failed_nfs_mount_$(mountpoint)");
}
body mount nfs_p(server,source,perm)
{
mount_type => "nfs4";
mount_source => "$(source)";
mount_server => "$(server)";
mount_options => {"$(perm)"};
edit_fstab => "true";
}
What I'm thinking about is something along the lines of:
mount_timeout => "10";
Possible? Other ideas?
Cheers,
Robert
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine