Call qemu monitor command directly within a special job that is only
allowed during outgoing migration.
---
src/qemu/qemu_domain.c | 1 -
src/qemu/qemu_domain.h | 6 ------
src/qemu/qemu_driver.c | 23 +++++++++++++++--------
src/qemu/qemu_migration.c | 13 -------------
4 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7748592..4c43e8b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -186,7 +186,6 @@ qemuDomainObjResetAsyncJob(qemuDomainObjPrivatePtr priv)
job->start = 0;
memset(&job->info, 0, sizeof(job->info));
job->signals = 0;
- memset(&job->signalsData, 0, sizeof(job->signalsData));
}
void
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index fa4e182..1593257 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -75,11 +75,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 */
- QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME = 1 << 2, /* Request migration downtime change
*/
-};
-
-struct qemuDomainJobSignalsData {
- unsigned long long migrateDowntime; /* Data for QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME */
};
struct qemuDomainJobObj {
@@ -95,7 +90,6 @@ struct qemuDomainJobObj {
virCond signalCond; /* Use to coordinate the safe queries during migration */
unsigned int signals; /* Signals for running job */
- struct qemuDomainJobSignalsData signalsData; /* Signal specific data */
};
typedef struct _qemuDomainPCIAddressSet qemuDomainPCIAddressSet;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f0c6489..99fab1a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7387,19 +7387,23 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ qemuDriverUnlock(driver);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
qemuReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
- goto cleanup;
+ return -1;
}
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
- goto cleanup;
+ goto endjob;
}
priv = vm->privateData;
@@ -7407,18 +7411,21 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not being migrated"));
- goto cleanup;
+ goto endjob;
}
- VIR_DEBUG("Requesting migration downtime change to %llums", downtime);
- priv->job.signalsData.migrateDowntime = downtime;
- priv->job.signals |= QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME;
- ret = 0;
+ VIR_DEBUG("Setting migration downtime to %llums", downtime);
+ ignore_value(qemuDomainObjEnterMonitor(driver, vm));
+ ret = qemuMonitorSetMigrationDowntime(priv->mon, downtime);
+ qemuDomainObjExitMonitor(driver, vm);
+
+endjob:
+ if (qemuDomainObjEndJob(driver, vm) == 0)
+ vm = NULL;
cleanup:
if (vm)
virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
return ret;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7c5583b..dbf0412 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -775,19 +775,6 @@ qemuMigrationProcessJobSignals(struct qemud_driver *driver,
VIR_DEBUG("Pausing domain for non-live migration");
if (qemuMigrationSetOffline(driver, vm) < 0)
VIR_WARN("Unable to pause domain");
- } else if (priv->job.signals & QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME) {
- unsigned long long ms = priv->job.signalsData.migrateDowntime;
-
- priv->job.signals ^= QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME;
- priv->job.signalsData.migrateDowntime = 0;
- VIR_DEBUG("Setting migration downtime to %llums", ms);
- ret = qemuDomainObjEnterMonitorWithDriver(driver, vm);
- if (ret == 0) {
- ret = qemuMonitorSetMigrationDowntime(priv->mon, ms);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- }
- if (ret < 0)
- VIR_WARN("Unable to set migration downtime");
} else {
ret = 0;
}
--
1.7.6