]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
lock.py: is_vpm should test is_vm 557/head
authorLoic Dachary <ldachary@redhat.com>
Wed, 1 Jul 2015 17:57:07 +0000 (19:57 +0200)
committerLoic Dachary <ldachary@redhat.com>
Wed, 1 Jul 2015 18:01:03 +0000 (20:01 +0200)
Testing the name of a machine to figure out if it is a virtual machine
is unreliable. Use the is_vm field of get_status instead.

Signed-off-by: Loic Dachary <loic@dachary.org>
teuthology/lock.py

index eb0f202952789f34af23c7b7daa5504a2dc7adf9..238961ac4bfe611d3542cff4d19a266cf263cdb2 100644 (file)
@@ -17,7 +17,9 @@ from .lockstatus import get_status
 
 log = logging.getLogger(__name__)
 
-is_vpm = lambda name: 'vpm' in name
+
+def is_vm(name):
+    return get_status(name)['is_vm']
 
 
 def get_distro_from_downburst():
@@ -311,7 +313,7 @@ def main(ctx):
         if ctx.owner is None and user is None:
             user = misc.get_user()
         # If none of them are vpm, do them all in one shot
-        if not filter(is_vpm, machines):
+        if not filter(is_vm, machines):
             res = unlock_many(machines, user)
             return 0 if res else 1
         for machine in machines: