28 lines
617 B
Python
28 lines
617 B
Python
|
from SWSCloudCore.models import Vms
|
||
|
|
||
|
|
||
|
class Controller_VMS_Server(object):
|
||
|
def __init__(self):
|
||
|
pass
|
||
|
|
||
|
def get(self, vm_id=None):
|
||
|
if vm_id:
|
||
|
return Vms.select().where(Vms.id == vm_id).get()
|
||
|
return Vms.select()
|
||
|
|
||
|
def exists(self, vm_id):
|
||
|
if Vms.select().where(Vms.id == vm_id).count() == 0:
|
||
|
return False
|
||
|
return True
|
||
|
|
||
|
def status_set(self, vm_id, status):
|
||
|
"""
|
||
|
|
||
|
:param vm_id:
|
||
|
:param status:
|
||
|
:return:
|
||
|
"""
|
||
|
x = Vms.update(status=status).where(Vms.id == vm_id)
|
||
|
x.execute()
|
||
|
return True
|