From 454f1edb394dc3e6a05c7246da8ef8cbbc406780 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 27 Feb 2025 10:56:01 -0800 Subject: [PATCH] Clear allocation when unlocking failed node requests If a subset of nodes in a multinode request fails, we will decline the request and unlock the nodes, but we do not clear the node allocation, which means that these ready nodes can not be reused until the original node request is resolved (and it may stick around to be tried by another provider). Handle this case by explicitly clearing the node allocations when unlocking the nodes from the declined request. Change-Id: I37560293976f594b1360ed4b17dac4f8a831d0cc --- nodepool/driver/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodepool/driver/__init__.py b/nodepool/driver/__init__.py index 5565158ad..96377b818 100644 --- a/nodepool/driver/__init__.py +++ b/nodepool/driver/__init__.py @@ -757,9 +757,11 @@ class NodeRequestHandler(NodeRequestHandlerNotifications, "when attempting to clean up the lock") return True + clear_allocation = False if self.failed_nodes: self.log.debug("Declining node request because nodes failed") self._declineRequest() + clear_allocation = True # We perform our own cleanup elif aborted_nodes: # Because nodes are added to the satisfied types list before they @@ -781,7 +783,7 @@ class NodeRequestHandler(NodeRequestHandlerNotifications, self.log.debug("Fulfilled node request") self.request.state = zk.FULFILLED - self.unlockNodeSet() + self.unlockNodeSet(clear_allocation=clear_allocation) self.zk.storeNodeRequest(self.request) self.zk.unlockNodeRequest(self.request) return True