[libvirt] [PATCH 6/4] nodeinfo: port nodecpumap to RHEL5

Eric Blake eblake at redhat.com
Fri Nov 16 17:23:15 UTC 2012


On 11/16/2012 09:57 AM, Viktor Mihajlovski wrote:
> On 11/15/2012 04:38 PM, Eric Blake wrote:
>> -    cpumap = linuxParseCPUmap(present, SYSFS_SYSTEM_PATH "/cpu/online");
>> +
>> +    if (virFileExists(SYSFS_SYSTEM_PATH "/cpu/online")) {
>> +        cpumap = linuxParseCPUmap(present, SYSFS_SYSTEM_PATH
>> "/cpu/online");
>> +    } else {
>> +        int i;
>> +
>> +        cpumap = virBitmapNew(present);
>> +        if (!cpumap) {
>> +            virReportOOMError();
>> +            return NULL;
>> +        }
>> +        for (i = 0; i < present; i++) {
>> +            int online = virNodeGetCpuValue(SYSFS_SYSTEM_PATH, i,
>> "online", 1);
>> +            if (online < 0) {
>> +                virBitmapFree(cpumap);
>> +                return NULL;
>> +            }
>> +            if (online)
>> +                ignore_value(virBitmapSetBit(cpumap, i));
>> +        }
>> +    }
>>       if (max_id && cpumap)
>>           *max_id = present;
>>       return cpumap;
>>
> 
> Fallback should provide correct result on back-level kernels. The code
> doesn't use the goto error/cleanup pattern, but there's a mixture in
> nodeinfo.c anyway and it wouldn't make it anymore compact. As far as
> I am concerned: +1.
> 

Thanks for reviewing.  I've now pushed these two.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121116/873e8e28/attachment-0001.sig>


More information about the libvir-list mailing list