[libvirt] [PATCH 16/41] qemu: Fill in CPU domain capabilities

John Ferlan jferlan at redhat.com
Mon Aug 29 21:59:02 UTC 2016



On 08/12/2016 09:33 AM, Jiri Denemark wrote:
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  src/qemu/qemu_capabilities.c                       |  24 +-
>  src/qemu/qemu_capabilities.h                       |   3 +-
>  src/qemu/qemu_driver.c                             |   7 +-
>  tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml   |  31 +-
>  .../qemu_2.6.0-gicv2-virt.aarch64.xml              |  37 +-
>  .../qemu_2.6.0-gicv3-virt.aarch64.xml              |  37 +-
>  tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml  |  37 +-
>  tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml  | 437 ++++++++++++++++++++-
>  tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml   |  35 +-
>  tests/domaincapstest.c                             |  56 ++-
>  10 files changed, 682 insertions(+), 22 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index aeea3a3..7a7ddb8 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4194,6 +4194,26 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os,
>  
>  
>  static int
> +virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
> +                             virQEMUCapsPtr qemuCaps,
> +                             virDomainCapsPtr domCaps)
> +{
> +
> +    if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM &&
> +        virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch))

                                    ^^^^
Can caps be NULL?

> +        domCaps->cpu.hostPassthrough = true;
> +
> +    if (qemuCaps->cpuDefinitions && caps && caps->host.cpu)

                                       ^^^^
Since you check here


So far as this patch it doesn't seem so and if I check at the end the
two callers to virQEMUCapsFillDomainCaps have failure paths for !caps
prior to the calls.

Perhaps adding a NONNULL to the prototype will just help clear things up.




> +        domCaps->cpu.hostModel = virQEMUCapsGuestIsNative(caps->host.arch,
> +                                                          qemuCaps->arch);
> +
> +    domCaps->cpu.custom = virObjectRef(qemuCaps->cpuDefinitions);
> +
> +    return 0;
> +}
> +
> +

[...]




More information about the libvir-list mailing list