move running_vm_statuses out of VMStatus
This commit is contained in:
parent
4541ac13bf
commit
c387bd3cfb
2 changed files with 9 additions and 6 deletions
4
main.py
4
main.py
|
@ -21,7 +21,7 @@ from typing import Union
|
|||
from functools import wraps
|
||||
from decouple import config
|
||||
from datetime import datetime
|
||||
from ucloud_common.enums import VMStatus, RUNNING_VM_STATUES
|
||||
from ucloud_common.enums import VMStatus, RUNNING_VM_STATUSES
|
||||
|
||||
running_vms = []
|
||||
vnc_port_pool = list(range(0, 100))
|
||||
|
@ -67,7 +67,7 @@ def goodbye(host):
|
|||
for vm in vms:
|
||||
vm.value["hostname"] = ""
|
||||
|
||||
if vm.value["status"] in VMStatus.running_vm_statuses:
|
||||
if vm.value["status"] in RUNNING_VM_STATUSES:
|
||||
vm.value["status"] = VMStatus.requested_start
|
||||
|
||||
client.put(vm.key, vm.value, value_in_json=True)
|
||||
|
|
|
@ -23,9 +23,12 @@ class VMStatus(Enum):
|
|||
running = "RUNNING"
|
||||
suspended = "SUSPENDED"
|
||||
|
||||
running_vm_statuses = (requested_shutdown, requested_suspend,
|
||||
requested_resume, requested_migrate,
|
||||
running, suspended)
|
||||
|
||||
class HostStatus(Enum):
|
||||
alive = "ALIVE"
|
||||
dead = "DEAD"
|
||||
dead = "DEAD"
|
||||
|
||||
|
||||
RUNNING_VM_STATUSES = [VMStatus.requested_shutdown, VMStatus.requested_suspend,
|
||||
VMStatus.requested_resume, VMStatus.requested_migrate,
|
||||
VMStatus.running, VMStatus.suspended]
|
Loading…
Reference in a new issue