From: Sandon Van Ness Date: Tue, 23 Jul 2013 23:10:24 +0000 (-0700) Subject: Re-create guest if it already exists X-Git-Tag: 1.1.0~2042^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e6a30d73a75b383db2c99ee2b471e1488397445c;p=teuthology.git Re-create guest if it already exists In some cases tests fail or nuke fails and the guest is not properly destroyed. This will look to see if it gets an error due to the guest already existing or its disks existing and will re-create the guest. Signed-off-by: Sandon Van Ness --- diff --git a/teuthology/lock.py b/teuthology/lock.py index 964f25400..1db09b285 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -590,6 +590,12 @@ def create_if_vm(ctx, machine_name): (machine_name,err)) else: log.info("%s created: %s" % (machine_name,owt)) + #If the guest already exists first destroy then re-create: + if 'exists' in err: + log.info("Guest files exist. Re-creating guest: %s" % + (machine_name)) + destroy_if_vm(ctx, machine_name) + create_if_vm(ctx, machine_name) return True # # Use downburst to destroy a virtual machine