Commit e4335b5b authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

locking.LockSet: Improve assertions


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 76e2f08a
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment