diff --git a/docs/plugins/multilab.md b/docs/plugins/multilab.md index ea98244965..9294e57f6a 100644 --- a/docs/plugins/multilab.md +++ b/docs/plugins/multilab.md @@ -47,6 +47,12 @@ Use the system-wide _netlab_ status file if multiple users start lab instances o All _netlab_ users should be able to write to the _netlab_ status file and the parent directory. ``` +_netlab_ locks the status file every time a lab instance changes its status, and gives up if it cannot get the lock within three seconds (*Cannot lock lab status file*). When many lab instances start or stop at the same time, increase the timeout with the **‌defaults.lab_status_lock_timeout** parameter (in seconds), for example: + +``` +defaults.lab_status_lock_timeout: 10 +``` + **Dynamic labs:** Users can run multiple lab instances, including several instances of the same lab topology. Each instance still needs a unique multilab ID that has to be allocated by an external system that passes **defaults.multilab.id** to _netlab_. ```{tip} diff --git a/netsim/utils/status.py b/netsim/utils/status.py index 11c1275397..143c14cef0 100644 --- a/netsim/utils/status.py +++ b/netsim/utils/status.py @@ -46,7 +46,7 @@ def change_status(topology: Box, callback: typing.Callable[[Box,Box], None]) -> log.fatal(f'Cannot create lab status directory {status_dir}') try: # Try to lock the status file - lock = FileLock(lock_file, timeout=3) + lock = FileLock(lock_file, timeout=topology.defaults.get('lab_status_lock_timeout',3)) lock.acquire() if os.path.exists(status_file): # If the status file exists, read it try: