From 62f4df30dccb9d8fd2c2dbfae7929441a0d46e4d Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Fri, 10 Jan 2025 15:09:24 +0100 Subject: [PATCH] lock/cli: don't update inventory if failed to create a vm If we were not able to create a vm we don't need to update machine's inventory, because there is going to be an ssh connection established to the host and teuthology gets stuck infinitely trying to connect to the machine which does not exist. Signed-off-by: Kyr Shatskyy --- teuthology/lock/cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/teuthology/lock/cli.py b/teuthology/lock/cli.py index e5f97fb63..ed4f28bd5 100644 --- a/teuthology/lock/cli.py +++ b/teuthology/lock/cli.py @@ -178,12 +178,14 @@ def main(ctx): # Update keys last updatekeys_machines = list() else: - machines_to_update.append(machine) ops.update_nodes([machine], True) - teuthology.provision.create_if_vm( + created = teuthology.provision.create_if_vm( ctx, misc.canonicalize_hostname(machine), ) + # do not try to update inventory if failed to create vm + if created: + machines_to_update.append(machine) with teuthology.parallel.parallel() as p: ops.update_nodes(reimage_machines, True) for machine in reimage_machines: -- 2.47.3