On Wed, Mar 14, 2012 at 11:26:54PM +0800, Osier Yang wrote:
---
src/qemu/qemu_process.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d55c269..e041f8d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1092,6 +1092,19 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainObjLock(vm);
event = virDomainEventPMSuspendNewFromObj(vm);
+ if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
+ VIR_DEBUG("Transitioned guest %s to pmsuspended state due to "
+ "QMP suspend event", vm->def->name);
+
+ virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
+ VIR_WARN("Unable to save status on vm %s after suspend event",
+ vm->def->name);
+ }
+ }
+
virDomainObjUnlock(vm);
if (event) {
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/