Revision 3782acd7 lib/backend.py
b/lib/backend.py | ||
---|---|---|
1001 | 1001 |
try: |
1002 | 1002 |
hyper.StopInstance(instance, retry=tried_once) |
1003 | 1003 |
except errors.HypervisorError, err: |
1004 |
if instance.name not in hyper.ListInstances(): |
|
1005 |
# if the instance is no longer existing, consider this a |
|
1006 |
# success and go to cleanup |
|
1007 |
break |
|
1004 | 1008 |
_Fail("Failed to stop instance %s: %s", iname, err) |
1005 | 1009 |
tried_once = True |
1006 | 1010 |
time.sleep(sleep_time) |
... | ... | |
1013 | 1017 |
try: |
1014 | 1018 |
hyper.StopInstance(instance, force=True) |
1015 | 1019 |
except errors.HypervisorError, err: |
1016 |
_Fail("Failed to force stop instance %s: %s", iname, err) |
|
1020 |
if instance.name in hyper.ListInstances(): |
|
1021 |
# only raise an error if the instance still exists, otherwise |
|
1022 |
# the error could simply be "instance ... unknown"! |
|
1023 |
_Fail("Failed to force stop instance %s: %s", iname, err) |
|
1017 | 1024 |
|
1018 | 1025 |
time.sleep(1) |
1019 | 1026 |
if instance.name in GetInstanceList([hv_name]): |
Also available in: Unified diff