[libvirt] [PATCHv3 3/4] virNodeGetCPUMap: Implement support function in nodeinfo

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Thu Oct 25 14:45:29 UTC 2012


On 10/25/2012 03:49 AM, Eric Blake wrote:

>
> +int nodeGetCPUMap(virConnectPtr conn,
> +                  unsigned char **cpumap,
> +                  unsigned int *online,
> +                  unsigned int flags)
> +{
> +    virBitmapPtr cpus = NULL;
> +    int maxpresent;
> +    int ret = -1;
> +    int dummy;
> +
> +    virCheckFlags(0, -1);
> +
> +    if (!(cpus = nodeGetCPUBitmap(conn, &maxpresent)))
> +        goto cleanup;
> +
> +    if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0)
> +        goto cleanup;
> +    if (online)
> +        *online = virBitmapCountBits(cpus);
Much nicer now.

Tested-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>

-- 

Mit freundlichen Grüßen/Kind Regards
    Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294




More information about the libvir-list mailing list