+ tried_once = False
+ while not tried_once and time.time() < end:
+ try:
+ hyper.StopInstance(instance, retry=tried_once)
+ except errors.HypervisorError, err:
+ _Fail("Failed to stop instance %s: %s", iname, err)
+ tried_once = True
+ time.sleep(sleep_time)
+ if instance.name not in hyper.ListInstances():