Re: [PATCH v4 1/2] libxl: fix node ranges in libxlNodeGetCellsFreeMemory()

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

 



Dario Faggioli wrote:
> introduced by cs 4b9eec50fe2c23343 ("libxl: implement per
> NUMA node free memory reporting"). What was wrong was that
> libxl_get_numainfo() put in nr_nodes the actual number of
> host NUMA nodes, not the highest node ID (like libnuma's
> numa_max_node() does instead).
>   

Ok, makes sense.

> While at it, turn the failure of libxl_get_numainfo() from
> a simple warning to a proper error, as requested during the
> review of another patch of the original series.
>   

ACK and pushed.  Thanks!

Regards,
Jim

> Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> Cc: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/libxl/libxl_driver.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 9e9bc89..04058d3 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -4107,23 +4107,23 @@ libxlNodeGetCellsFreeMemory(virConnectPtr conn,
>      if (virNodeGetCellsFreeMemoryEnsureACL(conn) < 0)
>          return -1;
>  
> -    /* Early failure is probably worth just a warning */
>      numa_info = libxl_get_numainfo(driver->ctx, &nr_nodes);
>      if (numa_info == NULL || nr_nodes == 0) {
> -        VIR_WARN("libxl_get_numainfo failed to retrieve NUMA data");
> -        return 0;
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("libxl_get_numainfo failed"));
> +        goto cleanup;
>      }
>  
>      /* Check/sanitize the cell range */
> -    if (startCell > nr_nodes) {
> +    if (startCell >= nr_nodes) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("start cell %d out of range (0-%d)"),
> -                       startCell, nr_nodes);
> +                       startCell, nr_nodes - 1);
>          goto cleanup;
>      }
>      lastCell = startCell + maxCells - 1;
> -    if (lastCell > nr_nodes)
> -        lastCell = nr_nodes;
> +    if (lastCell >= nr_nodes)
> +        lastCell = nr_nodes - 1;
>  
>      for (numCells = 0, n = startCell; n <= lastCell; n++) {
>          if (numa_info[n].size == LIBXL_NUMAINFO_INVALID_ENTRY)
>
>
>
>   

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