]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix for #5836 (--lock-many with vms)
authorSandon Van Ness <sandon@inktank.com>
Fri, 2 Aug 2013 00:04:04 +0000 (17:04 -0700)
committerSandon Van Ness <sandon@inktank.com>
Fri, 2 Aug 2013 00:06:16 +0000 (17:06 -0700)
This makes --lock-many work when --machine-type vps is passed.
Before it wasn't handled correctly and guests were not created.
Now it creates and gives the back the user the list-targets for
said guests.

teuthology-lock --lock-many 4 --machine-type vps --os-type centos

This fixes issue #5836

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
Reviewed-by: Alfredo Deza <alfredo@deza.pe>
teuthology/lock.py

index b0e0f62c8cfab3a2f9a043e872a6328ce416a859..65d1fcf796211ad1507e05dd3d85005b7ebde128 100644 (file)
@@ -28,6 +28,9 @@ def lock_many(ctx, num, machinetype, user=None, description=None):
     if success:
         machines = json.loads(content)
         log.debug('locked {machines}'.format(machines=', '.join(machines.keys())))
+        if ctx.machine_type == 'vps':
+            for machine in machines:
+                create_if_vm(ctx, machine)
         return machines
     if status == 503:
         log.error('Insufficient nodes available to lock %d nodes.', num)
@@ -366,9 +369,10 @@ Lock, unlock, or query lock status of machines.
         else:
             machines_to_update = result.keys()
             if ctx.machine_type == 'vps':
-                print "Locks successful"
-                print "Unable to display keys at this time (virtual machines are rebooting)."
-                print "Please run teuthology-lock --list-targets once these machines come up."
+                shortnames = ' '.join([name.split('@')[1].split('.')[0] for name in result.keys()])
+                print "Successfully Locked:\n%s\n" % shortnames
+                print "Unable to display keys at this time (virtual machines are booting)."
+                print "Please run teuthology-lock --list-targets %s once these machines come up." % shortnames
             else:
                 print yaml.safe_dump(dict(targets=result), default_flow_style=False)
     elif ctx.update: