QEMU: introduce Virtio free page reporting feature

This patch enables the free-page-reporting in qemu.

Signed-off-by: Nico Pache <npache@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Nico Pache 2020-10-12 19:35:38 -04:00 committed by Michal Privoznik
parent 5032b247e9
commit 021fea29c3
2 changed files with 12 additions and 0 deletions

View File

@ -3830,6 +3830,11 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
virTristateSwitchTypeToString(def->memballoon->autodeflate));
}
if (def->memballoon->free_page_reporting != VIR_TRISTATE_SWITCH_ABSENT) {
virBufferAsprintf(&buf, ",free-page-reporting=%s",
virTristateSwitchTypeToString(def->memballoon->free_page_reporting));
}
qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio);
if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0)

View File

@ -3926,6 +3926,13 @@ qemuValidateDomainDeviceDefMemballoon(const virDomainMemballoonDef *memballoon,
return -1;
}
if (memballoon->free_page_reporting != VIR_TRISTATE_SWITCH_ABSENT &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_FREE_PAGE_REPORTING)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("free-page-reporting is not supported by this QEMU binary"));
return -1;
}
if (qemuValidateDomainVirtioOptions(memballoon->virtio, qemuCaps) < 0)
return -1;