Re: [PATCH 2/6] qemu: Add -machine suffix automatically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 16, 2019 at 05:35:32PM +0200, Andrea Bolognani wrote:
> The QOM type for machine types is the machine type name
> followed by the -machine suffix. Since this is always the
> case, we can make virQEMUCapsMachineProps more readable
> and avoid repetition by not including the suffix there and
> adding it automatically while processing the data.
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/qemu/qemu_capabilities.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 66745ab4e2..34d162b9d1 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -1407,7 +1407,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsSPAPR[] = {
>  };
>  
>  static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] = {
> -    { "spapr-machine", virQEMUCapsMachinePropsSPAPR,
> +    { "spapr", virQEMUCapsMachinePropsSPAPR,
>        ARRAY_CARDINALITY(virQEMUCapsMachinePropsSPAPR),
>        -1 },
>  };
> @@ -2358,7 +2358,12 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
>  
>      for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsMachineProps); i++) {
>          virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
> -        const char *type = props.type;
> +        VIR_AUTOFREE(char *) type = NULL;
> +
> +        /* The QOM type for machine types is the machine type name
> +         * followed by the -machine suffix */
> +        if (virAsprintf(&type, "%s-machine", props.type) < 0)
> +            return -1;
>  
>          if ((nvalues = qemuMonitorGetObjectProps(mon, type, &values)) < 0)
>              return -1;

This patch on its own doesn't make that much sense and only adds some
extra memory allocation, but looking forward to the following
patches it is required to canonicalize the machine type.

Please move the patch next to the one which introduces the canonicalize
code and modify the commit message to reflect the actual need for this
change.

Pavel

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux