From cf41d9475445b62d69742d793c528fba733ef595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 10 Feb 2015 06:45:47 +0100 Subject: [PATCH] core: implement VM suspend Required for proper host sleep when netvm is running. --- core-modules/000QubesVm.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 9aad4d8a..7e73f77b 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1727,25 +1727,25 @@ class QubesVm(object): self.libvirt_domain.destroy() def suspend(self): - # TODO!!! if dry_run: return - if not self.is_running() and not self.is_paused(): - raise QubesException ("VM already stopped!") + if not self.is_running() and not self.is_paused() or \ + self.get_power_state() == "Suspended": + raise QubesException ("VM not running!") if len (self.pcidevs) > 0: - raise NotImplementedError + self.libvirt_domain.pMSuspendForDuration( + libvirt.VIR_NODE_SUSPEND_TARGET_MEM, 0, 0) else: self.pause() def resume(self): - # TODO!!! if dry_run: return if self.get_power_state() == "Suspended": - raise NotImplementedError + self.libvirt_domain.pMWakeup() else: self.unpause()