Merge "Add extra safety to metastatic bnr cleanup"
This commit is contained in:
commit
1c3cd06e99
@ -321,10 +321,18 @@ class MetastaticAdapter(statemachine.Adapter):
|
|||||||
self.log.info("Backing node %s has been idle for "
|
self.log.info("Backing node %s has been idle for "
|
||||||
"%s seconds, releasing",
|
"%s seconds, releasing",
|
||||||
bnr.node_id, now - bnr.last_used)
|
bnr.node_id, now - bnr.last_used)
|
||||||
|
# Set the bnr to failed just in case something
|
||||||
|
# goes wrong after this point, we won't use it
|
||||||
|
# any more.
|
||||||
|
bnr.failed = True
|
||||||
node = self._getNode(bnr.node_id)
|
node = self._getNode(bnr.node_id)
|
||||||
node.state = zk.USED
|
if node:
|
||||||
self.zk.storeNode(node)
|
# In case the node was already removed due
|
||||||
self.zk.forceUnlockNode(node)
|
# to an error, allow the bnr to still be
|
||||||
|
# cleaned up.
|
||||||
|
node.state = zk.USED
|
||||||
|
self.zk.storeNode(node)
|
||||||
|
self.zk.forceUnlockNode(node)
|
||||||
backing_node_records.remove(bnr)
|
backing_node_records.remove(bnr)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user