diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7b6e747..594c774 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1480,6 +1480,7 @@ static int qemudDomainResume(virDomainPtr dom) { virDomainObjPtr vm; int ret = -1; virDomainEventPtr event = NULL; + int reason; qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); @@ -1500,18 +1501,25 @@ static int qemudDomainResume(virDomainPtr dom) { "%s", _("domain is not running")); goto endjob; } - if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { - if (qemuProcessStartCPUs(driver, vm, dom->conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_NONE) < 0) { - if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("resume operation failed")); + if (virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED) { + if (reason != VIR_DOMAIN_PAUSED_SUSPEND) { + if (qemuProcessStartCPUs(driver, vm, dom->conn, + VIR_DOMAIN_RUNNING_UNPAUSED, + QEMU_ASYNC_JOB_NONE) < 0) { + if (virGetLastError() == NULL) + qemuReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("resume operation failed")); + goto endjob; + } + event = virDomainEventNewFromObj(vm, + VIR_DOMAIN_EVENT_RESUMED, + VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); + } else { + qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain paused from guest side can't be resumed, " + "you might want to wakeup it")); goto endjob; } - event = virDomainEventNewFromObj(vm, - VIR_DOMAIN_EVENT_RESUMED, - VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); } if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) goto endjob;