---
src/qemu/qemu_domain.h | 1 -
src/qemu/qemu_driver.c | 46 ++++++++++++++++++++++----------------------
src/qemu/qemu_migration.c | 6 +----
3 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 71cefd9..3da7931 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -68,7 +68,6 @@ enum qemuDomainAsyncJob {
enum qemuDomainJobSignals {
QEMU_JOB_SIGNAL_CANCEL = 1 << 0, /* Request job cancellation */
- QEMU_JOB_SIGNAL_SUSPEND = 1 << 1, /* Request VM suspend to finish live
migration offline */
};
struct qemuDomainJobObj {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d62e99d..8b186f7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1319,6 +1319,8 @@ static int qemudDomainSuspend(virDomainPtr dom) {
int ret = -1;
virDomainEventPtr event = NULL;
qemuDomainObjPrivatePtr priv;
+ virDomainPausedReason reason;
+ int eventDetail;
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -1345,34 +1347,32 @@ static int qemudDomainSuspend(virDomainPtr dom) {
priv = vm->privateData;
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT) {
- if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
- VIR_DEBUG("Requesting domain pause on %s",
- vm->def->name);
- priv->job.signals |= QEMU_JOB_SIGNAL_SUSPEND;
- }
- ret = 0;
- goto cleanup;
+ reason = VIR_DOMAIN_PAUSED_MIGRATION;
+ eventDetail = VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED;
} else {
- if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_SUSPEND) < 0)
- goto cleanup;
+ reason = VIR_DOMAIN_PAUSED_USER;
+ eventDetail = VIR_DOMAIN_EVENT_SUSPENDED_PAUSED;
+ }
- if (!virDomainObjIsActive(vm)) {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_SUSPEND) < 0)
+ goto cleanup;
+
+ if (!virDomainObjIsActive(vm)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
+ goto endjob;
+ }
+ if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
+ if (qemuProcessStopCPUs(driver, vm, reason) < 0) {
goto endjob;
}
- if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
- if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_USER) < 0) {
- goto endjob;
- }
- event = virDomainEventNewFromObj(vm,
- VIR_DOMAIN_EVENT_SUSPENDED,
- VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
- }
- if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
- goto endjob;
- ret = 0;
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SUSPENDED,
+ eventDetail);
}
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
+ goto endjob;
+ ret = 0;
endjob:
if (qemuDomainObjEndJob(driver, vm) == 0)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index ee2c5a0..de00811 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -770,11 +770,6 @@ qemuMigrationProcessJobSignals(struct qemud_driver *driver,
if (ret < 0) {
VIR_WARN("Unable to cancel job");
}
- } else if (priv->job.signals & QEMU_JOB_SIGNAL_SUSPEND) {
- priv->job.signals ^= QEMU_JOB_SIGNAL_SUSPEND;
- VIR_DEBUG("Pausing domain for non-live migration");
- if (qemuMigrationSetOffline(driver, vm) < 0)
- VIR_WARN("Unable to pause domain");
} else {
ret = 0;
}
@@ -2801,6 +2796,7 @@ qemuMigrationJobStart(struct qemud_driver *driver,
qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_NONE);
} else {
qemuDomainObjSetAsyncJobMask(vm, DEFAULT_JOB_MASK |
+ JOB_MASK(QEMU_JOB_SUSPEND) |
JOB_MASK(QEMU_JOB_MIGRATION_OP));
}
--
1.7.6