/start /stop and /suspend API for VM via container

This commit is contained in:
Julien Duponchelle committed 2016-04-12 18:02:36 +02:00
1 parent ad7ca86f32
commit 2055cdea5e
5 files changed
+144 -1

No files matched your search

+21
View File
@@ -110,6 +110,27 @@ class VM:
else:
self._properties[key] = value
@asyncio.coroutine
def start(self):
"""
Start a VM
"""
yield from self._hypervisor.post("/projects/{}/{}/vms/{}/start".format(self._project.id, self._vm_type, self._id))
@asyncio.coroutine
def stop(self):
"""
Stop a VM
"""
yield from self._hypervisor.post("/projects/{}/{}/vms/{}/stop".format(self._project.id, self._vm_type, self._id))
@asyncio.coroutine
def suspend(self):
"""
Suspend a VM
"""
yield from self._hypervisor.post("/projects/{}/{}/vms/{}/suspend".format(self._project.id, self._vm_type, self._id))
@asyncio.coroutine
def post(self, path, data={}):
"""