]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
lock: remove os_version and os_type for node before reprovisiong 1312/head 1316/head
authorRoman Grigoryev <roman.grigorev@suse.de>
Tue, 8 Oct 2019 09:38:14 +0000 (11:38 +0200)
committerRoman Grigoryev <roman.grigorev@suse.de>
Tue, 8 Oct 2019 09:47:53 +0000 (11:47 +0200)
os_version and os_type don't reflect actual os version
when node is under provisioning and/or provisiong failed.
The fix cleanup fileds before provisioning.

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

index 3be5324e042375877830e353e320d6fda3a34247..99a5e1ba5586d8ed74c82c068d399ceb33393e61 100644 (file)
@@ -169,11 +169,13 @@ def main(ctx):
                 updatekeys_machines = list()
             else:
                 machines_to_update.append(machine)
+                ops.update_nodes([machine], True)
                 teuthology.provision.create_if_vm(
                     ctx,
                     misc.canonicalize_hostname(machine),
                 )
         with teuthology.parallel.parallel() as p:
+            ops.update_nodes(reimage_machines, True)
             for machine in reimage_machines:
                 p.spawn(teuthology.provision.reimage, ctx, machine)
         for machine in updatekeys_machines:
index 9d6c86f73d2e6a30ef601e266dfe801b446fb3f2..3c04160b7c1f8890b838c373af2df6c2d6ab1279 100644 (file)
@@ -20,12 +20,20 @@ import keys
 log = logging.getLogger(__name__)
 
 
-def update_nodes(nodes):
+def update_nodes(nodes, reset_os=False):
     for node in nodes:
         remote = teuthology.orchestra.remote.Remote(
             canonicalize_hostname(node))
-        inventory_info = remote.inventory_info
-        teuthology.lock.ops.update_inventory(inventory_info)
+        if reset_os:
+            log.info("Updating [%s]: reset os type and version on server", node)
+            inventory_info = dict()
+            inventory_info['os_type'] = ''
+            inventory_info['os_version'] = ''
+            inventory_info['name'] = remote.hostname
+        else:
+            log.info("Updating [%s]: set os type and version on server", node)
+            inventory_info = remote.inventory_info
+        update_inventory(inventory_info)
 
 
 def lock_many_openstack(ctx, num, machine_type, user=None, description=None,
@@ -111,6 +119,7 @@ def lock_many(ctx, num, machine_type, user=None, description=None,
                 machines=', '.join(machines.keys())))
             if machine_type in vm_types:
                 ok_machs = {}
+                update_nodes(machines, True)
                 for machine in machines:
                     if teuthology.provision.create_if_vm(ctx, machine):
                         ok_machs[machine] = machines[machine]
@@ -130,6 +139,7 @@ def lock_many(ctx, num, machine_type, user=None, description=None,
                 )
                 with console_log.task(
                         ctx, console_log_conf):
+                    update_nodes(reimaged, True)
                     with teuthology.parallel.parallel() as p:
                         for machine in machines:
                             p.spawn(teuthology.provision.reimage, ctx, machine)