From d29a014699b51f960d1c1689aa560f480c1b2f7e Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 24 Sep 2024 15:43:18 -0700 Subject: [PATCH] Update node external_id in ZK on retries We currently only update the external_id record in ZK at the start and end of a statemachine lifecycle. That means we can miss getting a new external_id during a retry. To fix this, update the external_id any time it changes as long as the state machine does have an external_id (ie, we will not clear it from ZK). Change-Id: Ie4c5df89fd6afd0f8c7e3fdd1bccd2e499444aef --- nodepool/driver/statemachine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodepool/driver/statemachine.py b/nodepool/driver/statemachine.py index c18509665..243fae604 100644 --- a/nodepool/driver/statemachine.py +++ b/nodepool/driver/statemachine.py @@ -291,7 +291,8 @@ class StateMachineNodeLauncher(stats.StatsReporter): if state_machine.state != old_state: self.log.debug("State machine for %s advanced from %s to %s", node.id, old_state, state_machine.state) - if not node.external_id and state_machine.external_id: + if (state_machine.external_id and + node.external_id != state_machine.external_id): node.external_id = state_machine.external_id self.zk.storeNode(node) if state_machine.complete and not self.nodescan_request: