[libvirt] [PATCH 16/22] qemu: Store typename from query-cpu-definitions in qemuCaps

Peter Krempa pkrempa at redhat.com
Thu Oct 3 14:27:23 UTC 2019


On Thu, Oct 03, 2019 at 16:00:34 +0200, Jiri Denemark wrote:
> We need to create a mapping between CPU model names and their
> corresponding QOM types.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  src/qemu/qemu_capabilities.c                  |    4 +
>  src/qemu/qemu_monitor.c                       |    2 +
>  src/qemu/qemu_monitor.h                       |    1 +
>  src/qemu/qemu_monitor_json.c                  |    4 +
>  .../caps_2.10.0.aarch64.xml                   |  126 +-
>  .../caps_2.10.0.ppc64.xml                     | 1734 ++++++++--------
>  .../caps_2.10.0.s390x.xml                     |  264 +--
>  .../caps_2.10.0.x86_64.xml                    |  132 +-
>  .../caps_2.11.0.s390x.xml                     |  264 +--
>  .../caps_2.11.0.x86_64.xml                    |  136 +-
>  .../caps_2.12.0.aarch64.xml                   |  136 +-
>  .../caps_2.12.0.ppc64.xml                     | 1750 ++++++++---------
>  .../caps_2.12.0.s390x.xml                     |  264 +--
>  .../caps_2.12.0.x86_64.xml                    |  180 +-
>  .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1734 ++++++++--------
>  .../qemucapabilitiesdata/caps_2.9.0.s390x.xml |  256 +--
>  .../caps_2.9.0.x86_64.xml                     |  128 +-
>  .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1750 ++++++++---------
>  .../qemucapabilitiesdata/caps_3.0.0.s390x.xml |  272 +--
>  .../caps_3.0.0.x86_64.xml                     |  184 +-
>  .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1750 ++++++++---------
>  .../caps_3.1.0.x86_64.xml                     |  196 +-
>  .../caps_4.0.0.aarch64.xml                    |  148 +-
>  .../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1750 ++++++++---------
>  .../qemucapabilitiesdata/caps_4.0.0.s390x.xml |  284 +--
>  .../caps_4.0.0.x86_64.xml                     |  196 +-
>  .../caps_4.1.0.x86_64.xml                     |  400 ++--
>  .../caps_4.2.0.x86_64.xml                     |  400 ++--
>  28 files changed, 7228 insertions(+), 7217 deletions(-)

[...]

> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index c2a2f6eee6..c0cd195496 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -5571,6 +5571,10 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
>          if (VIR_STRDUP(cpu->name, tmp) < 0)
>              return -1;
>  
> +        if ((tmp = virJSONValueObjectGetString(child, "typename")) &&

Should we copy the string only if it's not an empty string?

> +            VIR_STRDUP(cpu->type, tmp) < 0)
> +            return -1;
> +
>          if (virJSONValueObjectHasKey(child, "unavailable-features")) {
>              virJSONValuePtr blockers;
>              size_t j;


> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
> index 162fb1f035..523b8abd11 100644
> --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
> @@ -143,873 +143,873 @@
>    <microcodeVersion>42900805</microcodeVersion>
>    <package> (v2.10.0)</package>
>    <arch>ppc64</arch>
> -  <cpu type='kvm' name='default'/>

[...]

> +  <cpu type='kvm' name='405' typename='405D4-powerpc64-cpu'/>
> +  <cpu type='kvm' name='403' typename='403GC-powerpc64-cpu'/>
> +  <cpu type='kvm' name='7457A_v1.2' typename=''/>
> +  <cpu type='kvm' name='750cl_v1.0' typename=''/>

So that these are also not emtpy? I can't imagine this being useful
information.

> +  <cpu type='kvm' name='750cxe_v2.1' typename=''/>
> +  <cpu type='kvm' name='755_v2.7' typename=''/>
> +  <cpu type='kvm' name='MPC8347ET' typename=''/>
> +  <cpu type='kvm' name='MPC8545E_v20' typename=''/>
> +  <cpu type='kvm' name='750_v2.1' typename=''/>




More information about the libvir-list mailing list