QEMU commit 46ea94ca9cf ("qmp: query-current-machine with
wakeup-suspend-support") added a new QMP command called
'query-current-machine' that retrieves guest parameters that
can vary in the same machine model (e.g. ACPI support for x86 VMs
depends on the '--no-acpi' option). Currently, this API has a single
flag, 'wakeup-suspend-support', that indicates whether the guest has
the capability of waking up from suspended state.
The original intent of this new API is to avoid situations such as [1],
where an user can execute "virsh dompmsuspend" in a guest that
can't wake up due to lack of support, making the guest unusable.
This is currently the case for any non-x86 arch guests and for
some x86 guests that starts with --no-acpi (q35 machines implements
suspend support even with the --no-acpi flag).
This is the Libvirt side of this API that will be available in
QEMU 4.0. QEMU_CAPS_QUERY_CURRENT_MACHINE is a new
virQEMUCapsCommands that will indicate if the QEMU binary
supports the 'query-current-machine' API. QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT
is a flag that reflects the 'wakeup-suspend-support' value
for the current QEMU instance. In the next patches these
two caps will be populated and used in qemu_driver.c,
'qemuDomainPMSuspendForDuration', to complete the fix
for [1].
[1]
https://github.com/open-power-host-os/qemu/issues/31
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_capabilities.c | 5 +++++
src/qemu/qemu_capabilities.h | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 56228e7a36..318198cbdd 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -523,6 +523,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"nvdimm.unarmed",
"scsi-disk.device_id",
"virtio-pci-non-transitional",
+ "query-current-machine",
+
+ /* 330 */
+ "wakeup-suspend-support",
);
@@ -978,6 +982,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
{ "query-cpus-fast", QEMU_CAPS_QUERY_CPUS_FAST },
{ "qom-list-properties", QEMU_CAPS_QOM_LIST_PROPERTIES },
{ "blockdev-del", QEMU_CAPS_BLOCKDEV_DEL },
+ { "query-current-machine", QEMU_CAPS_QUERY_CURRENT_MACHINE },
};
struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 06c7606e2f..633f2690a3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -506,6 +506,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check
*/
QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed= */
QEMU_CAPS_SCSI_DISK_DEVICE_ID, /* 'device_id' property of scsi disk */
QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL, /* virtio *-pci-{non-}transitional devices */
+ QEMU_CAPS_QUERY_CURRENT_MACHINE, /* query-current-machine command */
+
+ /* 330 */
+ QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT, /* query-current-machine API flag */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
--
2.20.1