Re: [PATCH v2 25/33] qemu: Make virQEMUCapsInitCPUModel testable

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

 




On 02/15/2017 11:44 AM, Jiri Denemark wrote:
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
> 
> Notes:
>     Version 2:
>     - no change
> 
>  src/qemu/qemu_capabilities.c | 19 ++++++++++++++-----
>  src/qemu/qemu_capspriv.h     | 10 ++++++++++
>  2 files changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index a77e300b7..3163bba8a 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -3204,7 +3204,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
>   *          1 when the caller should fall back to using virCapsPtr->host.cpu,
>   *         -1 on error.
>   */
> -static int
> +int
>  virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
>                          virDomainVirtType type,
>                          virCPUDefPtr cpu)
> @@ -3268,6 +3268,18 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
>  }
>  
>  
> +void
> +virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
> +                           virDomainVirtType type,
> +                           qemuMonitorCPUModelInfoPtr modelInfo)
> +{
> +    if (type == VIR_DOMAIN_VIRT_KVM)
> +        qemuCaps->kvmCPUModelInfo = modelInfo;
> +    else
> +        qemuCaps->tcgCPUModelInfo = modelInfo;
> +}
> +
> +
>  static int
>  virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
>                                  xmlXPathContextPtr ctxt,
> @@ -3354,10 +3366,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
>          }
>      }
>  
> -    if (type == VIR_DOMAIN_VIRT_KVM)
> -        qemuCaps->kvmCPUModelInfo = hostCPU;
> -    else
> -        qemuCaps->tcgCPUModelInfo = hostCPU;
> +    virQEMUCapsSetCPUModelInfo(qemuCaps, type, hostCPU);

I think this needs more consistency throughout this code.  That is all
places that are setting should be changed I think there's a couple
places that aren't (virQEMUCapsInitHostCPUModel and
virQEMUCapsLoadCPUModels)

Similarly for fetchers, but that's a different issue.

ACK if all the "sets" are covered... bonus points for "gets"

John

So this is the last patch I'll look at tonight - I'll try to look at the
rest later, but my availability will be limited.

>      hostCPU = NULL;
>      ret = 0;
>  
> diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
> index 75499d462..d4f13a2d2 100644
> --- a/src/qemu/qemu_capspriv.h
> +++ b/src/qemu/qemu_capspriv.h
> @@ -73,4 +73,14 @@ void
>  virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
>                              virCapsPtr caps,
>                              virDomainVirtType type);
> +
> +int
> +virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
> +                        virDomainVirtType type,
> +                        virCPUDefPtr cpu);
> +
> +void
> +virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
> +                           virDomainVirtType type,
> +                           qemuMonitorCPUModelInfoPtr modelInfo);
>  #endif
> 

--
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