[libvirt] [PATCH 1/3] adding QEMU_CAPS_QUERY_CURRENT_MACHINE and QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT

Peter Krempa pkrempa at redhat.com
Tue Apr 2 08:26:24 UTC 2019


On Mon, Apr 01, 2019 at 18:18:24 -0300, Daniel Henrique Barboza wrote:
> 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 at 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 */

This should include 'PM' in the name. Libvirt's suspend is a different
operation which does not need acpi.

Also the comment string is bad. You should mention that it's kind of
dynamic.

Additionally you didn't run tests there are at least 3 sets of test
files which show query-current-machine but this patch does not modify
the expected output files, thus it breaks the test suite.

>  
>      QEMU_CAPS_LAST /* this must always be the last item */
>  } virQEMUCapsFlags;
> -- 
> 2.20.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190402/95576ffb/attachment-0001.sig>


More information about the libvir-list mailing list