• Guido Trotter's avatar
    Add the delete() operation to SharedLock · a95fd5d7
    Guido Trotter authored
    This new operation lets a lock be cleanly deleted. The lock will be exclusively
    held before deletion, and after it pending and future acquires will raise an
    exception. Other SharedLock operations are modify to deal with delete() and to
    avoid code duplication.
    
    This patch also adds unit testing for the new function and its interaction with
    the other lock features. The helper threads are sligtly modified to handle and
    report the condition of a deleted lock. As a bonus a non-related unit test
    about not supporting non-blocking mode yet has been added as well.
    
    This feature will be used by the LockSet in order to support deadlock-free
    delete of resources. This in turn will be useful to gracefully handle the
    removal of instances and nodes from the cluster dealing with the fact that
    other operations may be pending on them.
    
    Reviewed-by: iustinp
    a95fd5d7
ganeti.locking_unittest.py 7.52 KB