Github user bhaisaab commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1408#discussion_r52552153 --- Diff: scripts/vm/network/security_group.py --- @@ -36,6 +39,18 @@ hyper = cfo.getEntry("hypervisor.type") if hyper == "lxc": driver = "lxc:///" + +lock_handle = None + +def file_is_locked(path): + global lock_handle + lock_handle = open(path, 'w') + try: + fcntl.lockf(lock_handle, fcntl.LOCK_EX | fcntl.LOCK_NB) --- End diff -- Please rename the method to reflect what it's doing; file_is_locked sounds like we're checking if a lock exists, whereas it's actually trying to create a lock. Any change you can use a with pattern, such as -- with (lock): do-stuff instead of if<get lock> do this? And how about we have a self-expiring locks, like here: http://stackoverflow.com/questions/5255220/fcntl-flock-how-to-implement-a-timeout ?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---