]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
lock: update target os-type and os-version after provisioning
authorRoman Grigoryev <roman.grigorev@suse.de>
Mon, 30 Sep 2019 11:55:42 +0000 (13:55 +0200)
committerRoman Grigoryev <roman.grigorev@suse.de>
Tue, 8 Oct 2019 09:47:53 +0000 (11:47 +0200)
After provisioning node via "teuthology-lock" (via both
"--lock" and "--lock-many") users cannot see actual
versioni and type  of provisioned OS in pulpito.
It is pretty helpful to see that version if we need to
do some manual work.

Signed-off-by: Roman Grigoryev <roman.grigorev@suse.de>
teuthology/lock/cli.py
teuthology/lock/ops.py

index 73e571662f72c01d201fcde52a3d88826613eaaa..3be5324e042375877830e353e320d6fda3a34247 100644 (file)
@@ -178,6 +178,7 @@ def main(ctx):
                 p.spawn(teuthology.provision.reimage, ctx, machine)
         for machine in updatekeys_machines:
             keys.do_update_keys([machine])
+        ops.update_nodes(reimage_machines + machines_to_update)
 
     elif ctx.unlock:
         if ctx.owner is None and user is None:
index 502297f454c32db6785bd40c41425702116779c4..9d6c86f73d2e6a30ef601e266dfe801b446fb3f2 100644 (file)
@@ -11,6 +11,8 @@ from teuthology import misc
 from teuthology.config import config
 from teuthology.contextutil import safe_while
 from teuthology.task import console_log
+import teuthology.task.internal
+from teuthology.misc import canonicalize_hostname
 
 import util
 import keys
@@ -18,6 +20,14 @@ import keys
 log = logging.getLogger(__name__)
 
 
+def update_nodes(nodes):
+    for node in nodes:
+        remote = teuthology.orchestra.remote.Remote(
+            canonicalize_hostname(node))
+        inventory_info = remote.inventory_info
+        teuthology.lock.ops.update_inventory(inventory_info)
+
+
 def lock_many_openstack(ctx, num, machine_type, user=None, description=None,
                         arch=None):
     os_type = teuthology.provision.get_distro(ctx)
@@ -109,6 +119,7 @@ def lock_many(ctx, num, machine_type, user=None, description=None,
                                   machine)
                         unlock_one(ctx, machine, user)
                     ok_machs = keys.do_update_keys(ok_machs.keys())[1]
+                update_nodes(ok_machs)
                 return ok_machs
             elif machine_type in reimage_types:
                 reimaged = dict()
@@ -124,6 +135,7 @@ def lock_many(ctx, num, machine_type, user=None, description=None,
                             p.spawn(teuthology.provision.reimage, ctx, machine)
                             reimaged[machine] = machines[machine]
                 reimaged = keys.do_update_keys(reimaged.keys())[1]
+                update_nodes(reimaged)
                 return reimaged
             return machines
         elif response.status_code == 503: