1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

If qemu status change internally we mirror it

This commit is contained in:
Julien Duponchelle 2017-01-17 16:03:12 +01:00
parent 6938e400d1
commit 82da073dd7
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -1066,7 +1066,14 @@ class QemuVM(BaseNode):
]) ])
if result is None: if result is None:
return result return result
return result.rsplit(' ', 1)[1] status = result.rsplit(' ', 1)[1]
if status == "running" or status == "prelaunch":
self.status = "started"
elif status == "suspended":
self.status = "suspended"
elif status == "shutdown":
self.status = "stopped"
return status
@asyncio.coroutine @asyncio.coroutine
def suspend(self): def suspend(self):
@ -1078,7 +1085,7 @@ class QemuVM(BaseNode):
vm_status = yield from self._get_vm_status() vm_status = yield from self._get_vm_status()
if vm_status is None: if vm_status is None:
raise QemuError("Suspending a QEMU VM is not supported") raise QemuError("Suspending a QEMU VM is not supported")
elif vm_status == "running": elif vm_status == "running" or vm_status == "prelaunch":
yield from self._control_vm("stop") yield from self._control_vm("stop")
self.status = "suspended" self.status = "suspended"
log.debug("QEMU VM has been suspended") log.debug("QEMU VM has been suspended")