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

Zhihua Che zhihua.che at gmail.com
Wed Apr 11 10:41:34 UTC 2012


在 2012年4月10日 下午4:33,Daniel P. Berrange <berrange at redhat.com> 写道:
> 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


I compile and install the libvirt-glib and I find its doc a little
lean. I mean it's really hard to get applicable info from it because
it just lists a list of functions without introducing any concepts
first.

I find the doc in share/gtk-doc directory. Do I miss anything?  Is
there any sample code or introduction to its concepts?

BTW, Does libvirt supply any function which can return the process
identifier of the domain?

Thanks




More information about the libvirt-users mailing list