Re: [PATCH 2/5] numa: Introduce virDomainNumaNodeDistanceSpecified

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

 




On 11/14/2017 09:47 AM, Michal Privoznik wrote:
> The function returns true/false depending on distance
> configuration being present in the domain XML.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/conf/numa_conf.c     | 13 +++++++++++++
>  src/conf/numa_conf.h     |  4 ++++
>  src/libvirt_private.syms |  1 +
>  3 files changed, 18 insertions(+)
> 
> diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
> index 5f0b3f9ed..6a42777e2 100644
> --- a/src/conf/numa_conf.c
> +++ b/src/conf/numa_conf.c
> @@ -1137,6 +1137,19 @@ virDomainNumaSetNodeCount(virDomainNumaPtr numa, size_t nmem_nodes)
>      return numa->nmem_nodes;
>  }
>  

Two blank lines here too.

> +bool
> +virDomainNumaNodeDistanceSpecified(virDomainNumaPtr numa,
> +                                   size_t node,
> +                                   size_t sibling)
> +{
> +    return node < numa->nmem_nodes &&
> +        sibling < numa->nmem_nodes &&
> +        numa->mem_nodes[node].distances &&
> +        numa->mem_nodes[node].distances[sibling].value != LOCAL_DISTANCE &&
> +        numa->mem_nodes[node].distances[sibling].value != REMOTE_DISTANCE;
> +}
> +
> +

According to how I read commit message '74119a03' it *is* possible to
set the @value to the same value as LOCAL_DISTANCE(10) or
REMOTE_DISTANCE(20) - so using that as a comparison for whether it was
specified would seem to be wrong.

Still if a distance *is* provided, then it seems that 'id' and 'value'
are also required to be provided or defaulted.  That means what seems to
matter regarding whether something was provided is if the *.value and/or
"*.cellid are zero

At least that's how I'm reading virDomainNumaDefNodeDistanceParseXML

John


>  size_t
>  virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
>                               size_t node,
> diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
> index 4655de3aa..1d2e605b6 100644
> --- a/src/conf/numa_conf.h
> +++ b/src/conf/numa_conf.h
> @@ -87,6 +87,10 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
>  
>  size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa);
>  
> +bool virDomainNumaNodeDistanceSpecified(virDomainNumaPtr numa,
> +                                        size_t node,
> +                                        size_t sibling)
> +    ATTRIBUTE_NONNULL(1);
>  size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
>                                      size_t node,
>                                      size_t sibling)
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 5a4d50471..779bab7a3 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -725,6 +725,7 @@ virDomainNumaGetNodeDistance;
>  virDomainNumaGetNodeMemoryAccessMode;
>  virDomainNumaGetNodeMemorySize;
>  virDomainNumaNew;
> +virDomainNumaNodeDistanceSpecified;
>  virDomainNumaSetNodeCount;
>  virDomainNumaSetNodeCpumask;
>  virDomainNumaSetNodeDistance;
> 

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