From: Roman Grigoryev Date: Mon, 30 Sep 2019 11:55:42 +0000 (+0200) Subject: lock: update target os-type and os-version after provisioning X-Git-Tag: 1.1.0~220^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5f5896c5ef3fa2cb3c31561dd1f25a15838658c4;p=teuthology.git lock: update target os-type and os-version after provisioning 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 --- diff --git a/teuthology/lock/cli.py b/teuthology/lock/cli.py index 73e571662f..3be5324e04 100644 --- a/teuthology/lock/cli.py +++ b/teuthology/lock/cli.py @@ -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: diff --git a/teuthology/lock/ops.py b/teuthology/lock/ops.py index 502297f454..9d6c86f73d 100644 --- a/teuthology/lock/ops.py +++ b/teuthology/lock/ops.py @@ -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: