qemu: caps: Always assume QEMU_CAPS_BALLOON_EVENT

The event was added to qemu by commit 973603a813c5d60 which is contained
in the 1.2.0 release.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Peter Krempa 2019-02-07 10:36:01 +01:00
parent 6d3c96f0d9
commit 3f2fa8f303
40 changed files with 11 additions and 87 deletions

View File

@ -987,7 +987,6 @@ struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
};
struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
{ "BALLOON_CHANGE", QEMU_CAPS_BALLOON_EVENT },
{ "SPICE_MIGRATE_COMPLETED", QEMU_CAPS_SEAMLESS_MIGRATION },
{ "DEVICE_DELETED", QEMU_CAPS_DEVICE_DEL_EVENT },
{ "MIGRATION", QEMU_CAPS_MIGRATION_EVENT },

View File

@ -183,7 +183,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_DUMP_GUEST_MEMORY, /* dump-guest-memory command */
QEMU_CAPS_NEC_USB_XHCI, /* -device nec-usb-xhci */
QEMU_CAPS_VIRTIO_S390, /* -device virtio-*-s390 */
QEMU_CAPS_BALLOON_EVENT, /* Async event for balloon changes */
X_QEMU_CAPS_BALLOON_EVENT, /* Async event for balloon changes */
/* 100 */
X_QEMU_CAPS_NETDEV_BRIDGE, /* bridge helper support */

View File

@ -10262,21 +10262,15 @@ qemuDomainMachineHasBuiltinIDE(const char *machine)
/**
* qemuDomainUpdateCurrentMemorySize:
*
* Updates the current balloon size from the monitor if necessary. In case when
* the balloon is not present for the domain, the function recalculates the
* maximum size to reflect possible changes.
* In case when the balloon is not present for the domain, the function
* recalculates the maximum size to reflect possible changes.
*
* Returns 0 on success and updates vm->def->mem.cur_balloon if necessary, -1 on
* error and reports libvirt error.
* Returns 0 on success and updates vm->def->mem.cur_balloon if necessary.
*/
int
qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
unsigned long long balloon;
int ret = -1;
/* inactive domain doesn't need size update */
if (!virDomainObjIsActive(vm))
return 0;
@ -10288,35 +10282,6 @@ qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
return 0;
}
/* current size is always automagically updated via the event */
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT))
return 0;
/* here we need to ask the monitor */
/* Don't delay if someone's using the monitor, just use existing most
* recent data instead */
if (qemuDomainJobAllowed(priv, QEMU_JOB_QUERY)) {
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
return -1;
if (virDomainObjCheckActive(vm) < 0)
goto endjob;
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorGetBalloonInfo(priv->mon, &balloon);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
endjob:
qemuDomainObjEndJob(driver, vm);
if (ret < 0)
return -1;
vm->def->mem.cur_balloon = balloon;
}
return 0;
}

View File

@ -20295,26 +20295,22 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver,
int *maxparams,
unsigned int privflags)
{
qemuDomainObjPrivatePtr priv = dom->privateData;
virDomainMemoryStatStruct stats[VIR_DOMAIN_MEMORY_STAT_NR];
int nr_stats;
unsigned long long cur_balloon = 0;
size_t i;
int err = 0;
if (!virDomainDefHasMemballoon(dom->def)) {
cur_balloon = virDomainDefGetMemoryTotal(dom->def);
} else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT)) {
cur_balloon = dom->def->mem.cur_balloon;
} else {
err = -1;
cur_balloon = dom->def->mem.cur_balloon;
}
if (!err && virTypedParamsAddULLong(&record->params,
&record->nparams,
maxparams,
"balloon.current",
cur_balloon) < 0)
if (virTypedParamsAddULLong(&record->params,
&record->nparams,
maxparams,
"balloon.current",
cur_balloon) < 0)
return -1;
if (virTypedParamsAddULLong(&record->params,

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -26,7 +26,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -25,7 +25,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -14,7 +14,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='scsi-disk.wwn'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -14,7 +14,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='scsi-disk.wwn'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -26,7 +26,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -25,7 +25,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -14,7 +14,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='scsi-disk.wwn'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -28,7 +28,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -25,7 +25,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -14,7 +14,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='scsi-disk.wwn'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -14,7 +14,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='scsi-disk.wwn'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -25,7 +25,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -14,7 +14,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='scsi-disk.wwn'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -25,7 +25,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -8,7 +8,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='scsi-disk.wwn'/>
<flag name='seccomp-sandbox'/>

View File

@ -8,7 +8,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='scsi-disk.wwn'/>
<flag name='seccomp-sandbox'/>

View File

@ -15,7 +15,6 @@
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='dump-guest-memory'/>
<flag name='balloon-event'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='usb-redir.filter'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -25,7 +25,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -28,7 +28,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -28,7 +28,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>

View File

@ -32,7 +32,6 @@
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>