Project

General

Profile

Actions

Bug #9871

closed

teuthology-lock --list/--list-targets etc. does not update keys for vms

Added by Dan Mick over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

Description

If one locks a few VMs, and then uses teuthology-lock --list-targets, the host keys displayed will be out of date, because lock.py explicitly avoids updating host keys unless machines are named on the commandline.

This should be something more like "avoid updating hostkeys if I've asked for --all, but otherwise update keys for all vms locked by me".

This seems to do the job, although I'm pretty sure it's not minimal:

--- a/teuthology/lock.py
+++ b/teuthology/lock.py
@@ -161,18 +161,27 @@ def main(ctx):
         else:
             statuses = list_locks()
         vmachines = []
+        my_vmachines = []

         for vmachine in statuses:
             if vmachine['vm_host']:
                 if vmachine['locked']:
                     vmachines.append(vmachine['name'])
+                    # if we don't specify machines, keep track of which
+                    # are ours, so that the update_keys below can only try
+                    # ours
+                    if vmachine['locked_by'] == user:
+                        my_vmachines.append(vmachine['name'])
         if vmachines:
             # Avoid ssh-keyscans for everybody when listing all machines
-            # Listing specific machines will update the keys.
-            if machines:
-                do_update_keys(vmachines)
-                statuses = [get_status(machine)
-                            for machine in machines]
+            # Listing specific machines will update the keys, and if none
+            # are specified, my_vmachines will also be updated (if any)
+            if machines or not ctx.all:
+                if my_vmachines:
+                    do_update_keys(my_vmachines)
+                if machines:
+                    statuses = [get_status(machine)
+                                for machine in machines]
             else:
                 statuses = list_locks()
         if statuses:
Actions #1

Updated by Dan Mick over 9 years ago

  • Source changed from other to Development
Actions #2

Updated by Dan Mick over 9 years ago

  • Status changed from New to Fix Under Review
  • Assignee set to Dan Mick
Actions #3

Updated by Dan Mick over 9 years ago

  • Status changed from Fix Under Review to Resolved

fff9626f2862bc3ff378129f9ff0b5b06a400344

Actions

Also available in: Atom PDF