1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu: Drop QEMU_CAPS_MIGRATION_EVENT

All QEMU versions we care about already support migration events.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jiri Denemark 2022-05-11 14:22:13 +02:00
parent b7fa48081d
commit b5fd70b367
40 changed files with 22 additions and 86 deletions

View File

@ -335,7 +335,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"pci-serial", /* QEMU_CAPS_DEVICE_PCI_SERIAL */
"aarch64-off", /* QEMU_CAPS_CPU_AARCH64_OFF */
"vhost-user-multiqueue", /* X_QEMU_CAPS_VHOSTUSER_MULTIQUEUE */
"migration-event", /* QEMU_CAPS_MIGRATION_EVENT */
"migration-event", /* X_QEMU_CAPS_MIGRATION_EVENT */
/* 190 */
"gpex-pcihost", /* QEMU_CAPS_OBJECT_GPEX */
@ -1237,7 +1237,6 @@ struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
/* Use virQEMUCapsQMPSchemaQueries for querying parameters of events */
struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
{ "MIGRATION", QEMU_CAPS_MIGRATION_EVENT },
{ "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE },
{ "BLOCK_WRITE_THRESHOLD", QEMU_CAPS_BLOCK_WRITE_THRESHOLD },
{ "DUMP_COMPLETED", QEMU_CAPS_DUMP_COMPLETED },

View File

@ -309,7 +309,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_DEVICE_PCI_SERIAL, /* -device pci-serial */
QEMU_CAPS_CPU_AARCH64_OFF, /* -cpu ...,aarch64=off */
X_QEMU_CAPS_VHOSTUSER_MULTIQUEUE, /* vhost-user with -netdev queues= */
QEMU_CAPS_MIGRATION_EVENT, /* MIGRATION event */
X_QEMU_CAPS_MIGRATION_EVENT, /* MIGRATION event */
/* 190 */
QEMU_CAPS_OBJECT_GPEX, /* have generic PCI host controller */

View File

@ -12509,17 +12509,13 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver,
virDomainObj *vm,
virDomainJobData *jobData)
{
qemuDomainObjPrivate *priv = vm->privateData;
qemuDomainJobDataPrivate *privStats = jobData->privateData;
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
if (jobData->status == VIR_DOMAIN_JOB_STATUS_ACTIVE ||
jobData->status == VIR_DOMAIN_JOB_STATUS_MIGRATING ||
jobData->status == VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED ||
jobData->status == VIR_DOMAIN_JOB_STATUS_POSTCOPY) {
if (events &&
jobData->status != VIR_DOMAIN_JOB_STATUS_ACTIVE &&
if (jobData->status != VIR_DOMAIN_JOB_STATUS_ACTIVE &&
qemuMigrationAnyFetchStats(driver, vm, VIR_ASYNC_JOB_NONE,
jobData, NULL) < 0)
return -1;

View File

@ -1735,10 +1735,8 @@ qemuMigrationJobCheckStatus(virQEMUDriver *driver,
virDomainJobData *jobData = priv->job.current;
qemuDomainJobDataPrivate *privJob = jobData->privateData;
g_autofree char *error = NULL;
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
if (!events ||
privJob->stats.mig.status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
if (privJob->stats.mig.status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
if (qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobData, &error) < 0)
return -1;
}
@ -1890,7 +1888,6 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriver *driver,
{
qemuDomainObjPrivate *priv = vm->privateData;
virDomainJobData *jobData = priv->job.current;
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
int rv;
jobData->status = VIR_DOMAIN_JOB_STATUS_MIGRATING;
@ -1900,24 +1897,14 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriver *driver,
if (rv < 0)
return rv;
if (events) {
if (virDomainObjWait(vm) < 0) {
if (virDomainObjIsActive(vm))
jobData->status = VIR_DOMAIN_JOB_STATUS_FAILED;
return -2;
}
} else {
/* Poll every 50ms for progress & to allow cancellation */
struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull };
virObjectUnlock(vm);
nanosleep(&ts, NULL);
virObjectLock(vm);
if (virDomainObjWait(vm) < 0) {
if (virDomainObjIsActive(vm))
jobData->status = VIR_DOMAIN_JOB_STATUS_FAILED;
return -2;
}
}
if (events)
ignore_value(qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobData, NULL));
ignore_value(qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobData, NULL));
qemuDomainJobDataUpdateTime(jobData);
qemuDomainJobDataUpdateDowntime(jobData);
@ -1939,13 +1926,9 @@ qemuMigrationDstWaitForCompletion(virQEMUDriver *driver,
virDomainAsyncJob asyncJob,
bool postcopy)
{
qemuDomainObjPrivate *priv = vm->privateData;
unsigned int flags = 0;
int rv;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT))
return 0;
VIR_DEBUG("Waiting for incoming migration to complete");
if (postcopy)
@ -4028,7 +4011,6 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
virErrorPtr orig_err = NULL;
unsigned int cookieFlags = 0;
bool abort_on_error = !!(flags & VIR_MIGRATE_ABORT_ON_ERROR);
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
bool bwParam = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH);
bool storageMigration = flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC);
bool cancel = false;
@ -4071,8 +4053,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
return -1;
}
if (events)
priv->signalIOError = abort_on_error;
priv->signalIOError = abort_on_error;
if (flags & VIR_MIGRATE_PERSIST_DEST) {
if (persist_xml) {
@ -4364,9 +4345,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
ret = 0;
cleanup:
if (events)
priv->signalIOError = false;
priv->signalIOError = false;
priv->migMaxBandwidth = restore_max_bandwidth;
virErrorRestore(&orig_err);

View File

@ -1419,26 +1419,23 @@ qemuMigrationCapsCheck(virQEMUDriver *driver,
}
}
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) {
migEvent = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
migEvent = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
ignore_value(virBitmapSetBit(migEvent, QEMU_MIGRATION_CAP_EVENTS));
ignore_value(virBitmapSetBit(migEvent, QEMU_MIGRATION_CAP_EVENTS));
if (!(json = qemuMigrationCapsToJSON(migEvent, migEvent)))
return -1;
if (!(json = qemuMigrationCapsToJSON(migEvent, migEvent)))
return -1;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
rc = qemuMonitorSetMigrationCapabilities(priv->mon, &json);
rc = qemuMonitorSetMigrationCapabilities(priv->mon, &json);
qemuDomainObjExitMonitor(vm);
qemuDomainObjExitMonitor(vm);
if (rc < 0) {
virResetLastError();
VIR_DEBUG("Cannot enable migration events; clearing capability");
virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
}
if (rc < 0) {
virResetLastError();
VIR_DEBUG("Cannot enable migration events");
}
/* Migration events capability must always be enabled, clearing it from

View File

@ -57,7 +57,6 @@
<flag name='VGA.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='rtl8139'/>
<flag name='e1000'/>
<flag name='virtio-net'/>

View File

@ -78,7 +78,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -60,7 +60,6 @@
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pci-serial'/>
<flag name='aarch64-off'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -59,7 +59,6 @@
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -62,7 +62,6 @@
<flag name='VGA.vgamem_mb'/>
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -62,7 +62,6 @@
<flag name='VGA.vgamem_mb'/>
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -36,7 +36,6 @@
<flag name='migrate-rdma'/>
<flag name='aes-key-wrap'/>
<flag name='dea-key-wrap'/>
<flag name='migration-event'/>
<flag name='virtio-net'/>
<flag name='virtio-gpu'/>
<flag name='virtio-gpu.virgl'/>

View File

@ -77,7 +77,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -77,7 +77,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -61,7 +61,6 @@
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='aarch64-off'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -59,7 +59,6 @@
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -36,7 +36,6 @@
<flag name='migrate-rdma'/>
<flag name='aes-key-wrap'/>
<flag name='dea-key-wrap'/>
<flag name='migration-event'/>
<flag name='virtio-net'/>
<flag name='virtio-gpu'/>
<flag name='virtio-gpu.virgl'/>

View File

@ -78,7 +78,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -63,7 +63,6 @@
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='aarch64-off'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -60,7 +60,6 @@
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -62,7 +62,6 @@
<flag name='VGA.vgamem_mb'/>
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -78,7 +78,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -25,7 +25,6 @@
<flag name='memory-backend-file'/>
<flag name='iothread'/>
<flag name='migrate-rdma'/>
<flag name='migration-event'/>
<flag name='chardev-file-append'/>
<flag name='vserport-change-event'/>
<flag name='spice-gl'/>

View File

@ -78,7 +78,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -62,7 +62,6 @@
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='aarch64-off'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -59,7 +59,6 @@
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -61,7 +61,6 @@
<flag name='VGA.vgamem_mb'/>
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -35,7 +35,6 @@
<flag name='migrate-rdma'/>
<flag name='aes-key-wrap'/>
<flag name='dea-key-wrap'/>
<flag name='migration-event'/>
<flag name='virtio-net'/>
<flag name='virtio-gpu'/>
<flag name='virtio-gpu.virgl'/>

View File

@ -77,7 +77,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -61,7 +61,6 @@
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='aarch64-off'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -35,7 +35,6 @@
<flag name='migrate-rdma'/>
<flag name='aes-key-wrap'/>
<flag name='dea-key-wrap'/>
<flag name='migration-event'/>
<flag name='virtio-net'/>
<flag name='virtio-gpu'/>
<flag name='virtio-gpu.virgl'/>

View File

@ -76,7 +76,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -76,7 +76,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -66,7 +66,6 @@
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='aarch64-off'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -59,7 +59,6 @@
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -76,7 +76,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -66,7 +66,6 @@
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='aarch64-off'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -65,7 +65,6 @@
<flag name='vmware-svga.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>

View File

@ -76,7 +76,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>

View File

@ -76,7 +76,6 @@
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='migration-event'/>
<flag name='gpex-pcihost'/>
<flag name='ioh3420'/>
<flag name='x3130-upstream'/>