Re: [PATCHv8 04/17] util: Add interface to determine monitor path

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

 




On 11/12/18 8:31 AM, Wang Huaqiang wrote:
> Add interface for resctrl monitor to determine the path.
> 
> Signed-off-by: Wang Huaqiang <huaqiang.wang@xxxxxxxxx>
> 
> Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/libvirt_private.syms |  1 +
>  src/util/virresctrl.c    | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/util/virresctrl.h    |  5 ++++-
>  3 files changed, 60 insertions(+), 1 deletion(-)
> 

[...]

> diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
> index 463555c..aa062c3 100644
> --- a/src/util/virresctrl.c
> +++ b/src/util/virresctrl.c

[...]

> +int
> +virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
> +                               const char *machinename)
> +{
> +    VIR_AUTOFREE(char *) parentpath = NULL;
> +
> +    if (!monitor) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("Invalid resctrl monitor"));
> +        return -1;
> +    }

In the v7 in a follow-up to patch 4 we agreed the following check was fine:

    if (!monitor->alloc) {
        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                       _("Missing resctrl monitor alloc"));
        return -1;
    }

> +
> +    if (monitor->path) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Resctrl monitor path is already set to '%s'"),
> +                       monitor->path);
> +        return -1;
> +    }
> +
> +    if (monitor->id && monitor->alloc && monitor->alloc->id) {
> +        if (STREQ(monitor->id, monitor->alloc->id)) {
> +            if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0)
> +                return -1;
> +            return 0;
> +        }
> +    }

Changing the above to

    if (STREQ_NULLABLE(monitor->id, monitor->alloc->id)) {
        if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0)
            return -1;
        return 0;

With that,

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John

[...]

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