mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
qemu: Remove special case for virDomainMigrateSetMaxDowntime
Call qemu monitor command directly within a special job that is only allowed during outgoing migration.
This commit is contained in:
parent
d1bd3f57bc
commit
63d15036cc
@ -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
|
||||
|
@ -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;
|
||||
|
@ -7989,18 +7989,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;
|
||||
}
|
||||
|
||||
@ -8018,19 +8021,23 @@ qemuDomainMigrateSetMaxSpeed(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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user