Re: [PATCH 6/7] Do not use vshPrintPinInfo in iothreadinfo

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

 




On 03/25/2015 02:39 PM, Ján Tomko wrote:
> Just format the bitmap via virBitmapFormat.
> ---
>  tools/virsh-domain.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index afd92b1..cb9cb9d 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -6834,6 +6834,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
>      size_t i;
>      int maxcpu;
>      unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
> +    virBitmapPtr map = NULL;
>  
>      VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
>      VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
> @@ -6863,16 +6864,24 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
>                    _("IOThread ID"), _("CPU Affinity"));
>      vshPrintExtra(ctl, "---------------------------------------------------\n");
>      for (i = 0; i < niothreads; i++) {
> +        char *mapstr = NULL;

Considering the other discussion about Set/Add/Del IOThread and since
you're modifying the code anyway...

How about adding a check for:

if (info[i].iothread_id == 0)
    continue;

That way we can "prepare" for a configuration that may have "holes" on
the delete and won't have some future issue with a 1.2.14 virsh
receiving something unexpected from a 1.2.15 daemon.

John
> +        virBitmapFree(map);
> +        map = virBitmapNewData(info[i]->cpumap, info[i]->cpumaplen);
> +        if (!map)
> +            goto cleanup;
> +
> +        if (!(mapstr = virBitmapFormat(map)))
> +            goto cleanup;
>  
>          vshPrint(ctl, " %-15u ", info[i]->iothread_id);
> -        ignore_value(vshPrintPinInfo(info[i]->cpumap, info[i]->cpumaplen,
> -                                     maxcpu, 0));
> +        vshPrint(ctl, " %-15s ", mapstr);
>          vshPrint(ctl, "\n");
>          virDomainIOThreadInfoFree(info[i]);
>      }
>      VIR_FREE(info);
>  
>   cleanup:
> +    virBitmapFree(map);
>      virDomainFree(dom);
>      return niothreads >= 0;
>  }
> 

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