[libvirt] Looking for good example API function(s)

Daniel Veillard veillard at redhat.com
Wed Mar 11 13:35:40 UTC 2009

On Tue, Mar 10, 2009 at 11:36:01AM -0400, Laine Stump wrote:
> To help with lutter's network configuration project, I'm looking at  
> adding API functions to libvirt which are essentially pass-throughs to  
> netcf library APIs called by libvirtd. Can someone point me to good  
> examples of APIs that are not hypervisor driver-dependent (and possibly  
> not host OS-dependent either - I believe the final intent is for netcf  
> to handle all host OS dependencies itself) to use as a basis for writing  
> these new APIs?

  Well you can start to look at existng network interfaces like
you can find the signatures in include/libvirt/libvirt.h[.in]
and the real API entry point in src/libvirt.c
Then everything is dispatched to some kind of drivers associated to
the connection (depending how it was established).

> At a more detailed level, a quick trace through the code of some other  
> APIs got me as far as the call to the "call" function, with an RPC code,  
> but I didn't find where that call was caught (and the RPC code  
> interpreted, eg REMOTE_PROC_NETWORK_CREATE_XML - cscope couldn't find  
> any other reference to this value) on the libvirtd side. I'm about run  
> virsh and libvirtd under gdb to learn this by experimentation, but if  
> someone wants to take the fun out of it for me, hints would be gladly  
> accepted!  ;-)

  Well depending on how the client library is being used to connect to
the host there is multiple variation but the implermentation will go 
though a driver, with either a local execution or a remote one, where
the execution will be called from the daemon (in qemud).
  The fact that you ended up in a remote execution is probably normal
if you were not root on the target box, and in many case still
everything is centralized in the daemon.
  For the remote stubs they are of course generated which may explain
why your index didn't include said funtions.


Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

More information about the libvir-list mailing list