From f451ed144e06f2fb2df4df2c7860ad5887d08d56 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 22 Mar 2015 20:40:19 -0600 Subject: [PATCH] Prevent error when suspend/resume is not supported in QEMU VM. --- gns3server/modules/qemu/qemu_vm.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index ba5b098b..7d1675ee 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -722,6 +722,8 @@ class QemuVM(BaseVM): b"restore-vm", b"running", b"save-vm", b"shutdown", b"suspended", b"watchdog", b"guest-panicked" ]) + if result is None: + return result return result.rsplit(' ', 1)[1] @asyncio.coroutine @@ -731,7 +733,9 @@ class QemuVM(BaseVM): """ vm_status = yield from self._get_vm_status() - if vm_status == "running": + if vm_status is None: + raise QemuError("Suspending a QEMU VM is not supported") + elif vm_status == "running": yield from self._control_vm("stop") log.debug("QEMU VM has been suspended") else: @@ -753,7 +757,9 @@ class QemuVM(BaseVM): """ vm_status = yield from self._get_vm_status() - if vm_status == "paused": + if vm_status is None: + raise QemuError("Resuming a QEMU VM is not supported") + elif vm_status == "paused": yield from self._control_vm("cont") log.debug("QEMU VM has been resumed") else: