[Libvir] RFC: requesting APIs for host physical resource discovery

Daniel Veillard veillard at redhat.com
Wed Mar 29 14:49:16 UTC 2006


On Thu, Mar 23, 2006 at 09:03:55PM +0000, Daniel P. Berrange wrote:
> On Thu, Mar 23, 2006 at 12:35:12PM -0800, Gareth S Bestor wrote:
> > I agree to some extent, but I might suggest that discovery and exposure of
> > host system physical resources may be better left to other APIs, since such
> > functionality has widespread uses outside of virtualization management.
> > 
> > Since you bring it up, we - Open Source CIM interfaces for Xen, via libvirt
> > - are actually having to face this exact problem today, namely what is/are
> > good standardized cross-platform cross-distro Linux interfaces for exposing
> > physical hardware info necessary for virtual resource allocation. Right now
> > we have a some Open Source Linux CIM providers exposing h/w info mined out
> > of, say, /proc, but the architecture and distro ifdefs are getting out of
> > hand... You are quite correct in stating this requirement, and there seems
> > to be multiple candidates (SMBIOS, HPI, SNMP, etc) but I don't have a good
> > answer. My concern would be trying to add and solve this problem within the
> > scope of libvirt.
> 
> I don't think it is neccessary (or desirable) to solve the general resource 
> discovery problem within libvirt - I'd limit scope to only those resources 
> where there is a need for consistency with the VMM's view of resources.

  Okay, here is what I added:

  http://libvirt.org/html/libvirt-libvirt.html#virNodeInfo

Structure virNodeInfo
struct _virNodeInfo {
    charmodel[32]	model	: string indicating the CPU model
    unsigned long	memory	: memory size in megabytes
    unsigned int	cpus	: the number of active CPUs
    unsigned int	mhz	: expected CPU frequency
    unsigned int	nodes	: the number of NUMA cell, 1 for uniform
    unsigned int	sockets	: number of CPU socket per node
    unsigned int	cores	: number of core per socket
    unsigned int	threads	: number of threads per core
}

  and
  http://libvirt.org/html/libvirt-libvirt.html#virNodeGetInfo

int	virNodeGetInfo			(virConnectPtr conn, 
					 virNodeInfoPtr info)

This limits the API purely to hardware informations. Those informations
can be extracted from Xend, and could potentially be obtained directly
(I didn't checked if there was hypervisor calls for this, could be done
with /proc and heuristics, but I would rather avoid it).
This doesn't cover topology, nor maps of online/offline processors, 
this sounds premature to me at this point and could be added as separate
APIs later.
It's checked in CVS and there is Python bindings for it
see python/tests/node.py

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




More information about the libvir-list mailing list