Fix for clearing assigned nodes that have vanished

If a node request disappears, we are assuming the node znodes that
have been assigned to it are still around, but it turns out they
may not be for strange, odd reasons. Attempting to store to them will
cause errors. We need to handle that.

Change-Id: I10dbce96e4d789a0d1d8d82d72a780fb63b66d62
This commit is contained in:
David Shrewsbury 2020-02-27 17:31:49 -05:00
parent 5d37a0a6e1
commit aba9b4e134
1 changed files with 5 additions and 5 deletions

View File

@ -601,7 +601,10 @@ class NodeRequestHandler(NodeRequestHandlerNotifications,
if clear_allocation:
node.allocated_to = None
self.zk.storeNode(node)
try:
self.zk.storeNode(node)
except Exception:
self.log.exception("Error clearing node allocation:")
try:
self.zk.unlockNode(node)
@ -674,10 +677,7 @@ class NodeRequestHandler(NodeRequestHandlerNotifications,
# requests can use them.
if not self.zk.getNodeRequest(self.request.id):
self.log.info("Node request disappeared")
for node in self.nodeset:
node.allocated_to = None
self.zk.storeNode(node)
self.unlockNodeSet()
self.unlockNodeSet(clear_allocation=True)
try:
self.zk.unlockNodeRequest(self.request)
except exceptions.ZKLockException: