[libvirt-users] [API reference] Are there XML-handling API to retrieve info directly from xml configure file

Daniel P. Berrange berrange at redhat.com
Tue Apr 10 08:33:09 UTC 2012


On Sat, Apr 07, 2012 at 10:36:04PM +0100, Richard W.M. Jones wrote:
> On Fri, Apr 06, 2012 at 03:24:25PM +0800, Zhihua Che wrote:
> > Hi, everyone
> > 
> >     I'm writing a application using libvirt and need to query guest
> > os's virtual network interface usage, like bytes read or written
> > through a given interface. I know int
> > virDomainInterfaceStats(virDomainPtr dom, const char * path,
> > 		virDomainInterfaceStatsPtr stats,  size_t size) is designed for my
> > purpose but I 'm not sure how I determine the second parameter path.
> > I'm now think of determining the virtual interface by parsing the
> > domain's xml configure file.
> > But I don't find that libvirt  supply such functions, that means, I
> > have to resort to other library lik libxml?
> 
> I would also really like to see such an API/APIs in the basic
> libvirt API.

The libvirt-gconfig library provides this capability. NB, the libvirt-gconfig
library is strictly independant of libvirt-gobject, since it is intended that
you can use the libvirt-gconfig XML handling APIs, with the plain C libvirt
APIs.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list