On 11/01/2012 09:43 AM, Viktor Mihajlovski wrote: > Since /sys/devices/system/cpu/present is not available on > older kernels like on RHEL 5.x nodeGetCPUCount will > fail there. The fallback implemented is to scan for > /sys/devices/system/cpu/cpuNN entries. > > Signed-off-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx> > --- > src/nodeinfo.c | 33 ++++++++++++++++++++++++++++----- > 1 files changed, 28 insertions(+), 5 deletions(-) I like this. I'll give it a run through my RHEL 5 VM, and if it works, I'll install this before 1.0.0. > + if (virFileExists(SYSFS_SYSTEM_PATH "/cpu/present")) { > + i = linuxParseCPUmax(SYSFS_SYSTEM_PATH "/cpu/present"); > + } else if (virFileExists(SYSFS_SYSTEM_PATH "/cpu/cpu0")) { > + do { > + i++; > + VIR_FREE(cpupath); > + if (virAsprintf(&cpupath, "%s/cpu/cpu%d", > + SYSFS_SYSTEM_PATH, i) < 0) { > + virReportOOMError(); > + return -1; > + } > + } while (virFileExists(cpupath)); Okay, so this leaves 'i' at one larger than the maximum found cpu/cpuNN, under the assumption is that if cpu/present is not found, then you can't offline cpus, so cpu/cpuNN will exist and be contiguous. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list