]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
lock/cli: don't update inventory if failed to create a vm
authorKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Fri, 10 Jan 2025 14:09:24 +0000 (15:09 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Thu, 30 Jan 2025 09:30:39 +0000 (10:30 +0100)
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 <kyrylo.shatskyy@clyso.com>
teuthology/lock/cli.py

index e5f97fb63444b01ff557ab24b855b2d86b744984..ed4f28bd5a78ff10cf5167b1111d83693442db2d 100644 (file)
@@ -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: