diff --git a/lib/locking.py b/lib/locking.py index adc7a235ef8346ed343af63fe7aefffd7234b74e..f13d7b23f5549298c3e885598d1cf04006a74cdb 100644 --- a/lib/locking.py +++ b/lib/locking.py @@ -699,6 +699,9 @@ class LockSet: def _del_owned(self, name=None): """Note the current thread owns the given lock""" + assert not (name is None and self.__lock._is_owned()), \ + "Cannot hold internal lock when deleting owner status" + if name is not None: self.__owners[threading.currentThread()].remove(name) @@ -1212,7 +1215,9 @@ class GanetiLockManager: assert (not self._contains_BGL(level, names) or not self._upper_owned(LEVEL_CLUSTER)), ( "Cannot release the Big Ganeti Lock while holding something" - " at upper levels") + " at upper levels (%r)" % + (", ".join(["%s=%r" % (LEVEL_NAMES[i], self._list_owned(i)) + for i in self.__keyring.keys()]), )) # Release will complain if we don't own the locks already return self.__keyring[level].release(names)