
On Tue, Jul 24, 2007 at 06:41:57PM +0100, Daniel P. Berrange wrote:
While fixing the QEMU nodeinfo API to correctly deal with case where CPU sockets have sparse numbering (eg sockets 0 & 3 are populated), I realized that OpenVZ doesn't have a nodeinfo API, and its requirements are basically identical to the QEMU driver's. So this patch moves the impl of the nodeinfo API into a nodeinfo.c file, and makes both the QEMU and OpenVZ driver call out to this shared impl. I also put #ifdef __linux__ around the impl since code reading /proc/cpuinfo is never going to work on any non-Linux platform. For non linux I just return -1 which'll get treated as not-implemented. If QEMU driver is ported to work on Solaris, the nodeinfo.c file can be easily extended for their custom impl. Finally I'm adding a testcase with a bunch of example /proc/cpuinfo files to validate correctness
Sounds just right, thanks !
diff -u -p -u -p -r1.46 Makefile.am --- src/Makefile.am 19 Jul 2007 16:22:40 -0000 1.46 +++ src/Makefile.am 24 Jul 2007 17:40:32 -0000 @@ -50,6 +50,7 @@ CLIENT_SOURCES = \ qemu_conf.c qemu_conf.h \ openvz_conf.c openvz_conf.h \ openvz_driver.c openvz_driver.h \ + nodeinfo.h nodeinfo.c \ util.c util.h
I will have to exclude those from docs/generator.py (or fix the logic of said generator selection of files) Looks good, +1, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/