Revision 02feca11 logic/utils.py
b/logic/utils.py | ||
---|---|---|
20 | 20 |
raise VirtualMachine.InvalidBackendIdError(str(name)) |
21 | 21 |
|
22 | 22 |
return int(ns) |
23 |
|
|
24 |
|
|
25 |
def get_rsapi_state(vm): |
|
26 |
"""Returns the RSAPI state for a virtual machine""" |
|
27 |
try: |
|
28 |
r = VirtualMachine.RSAPI_STATE_FROM_OPER_STATE[vm._operstate] |
|
29 |
except KeyError: |
|
30 |
return "UNKNOWN" |
|
31 |
# A machine is in REBOOT if an OP_INSTANCE_REBOOT request is in progress |
|
32 |
if r == 'ACTIVE' and vm._backendopcode == 'OP_INSTANCE_REBOOT' and \ |
|
33 |
vm._backendjobstatus in ('queued', 'waiting', 'running'): |
|
34 |
return "REBOOT" |
|
35 |
return r |
Also available in: Unified diff