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

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



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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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