]> xenbits.xensource.com Git - libvirt.git/commit
libxl: implement virDomainInterfaceStats
authorJoao Martins <joao.m.martins@oracle.com>
Mon, 23 Nov 2015 18:57:00 +0000 (18:57 +0000)
committerJim Fehlig <jfehlig@suse.com>
Wed, 2 Dec 2015 17:04:34 +0000 (10:04 -0700)
commitd2e5538b16e325d9095f3ccb0dac88bbd9fc98f0
treed9a0201f131bc15330329f9de8e40d629a4a69a3
parentaf2954ae711a315d9dfe66a251f154824d0491c4
libxl: implement virDomainInterfaceStats

Introduce support for domainInterfaceStats API call for querying
network interface statistics. Consequently it also enables the
use of `virsh domifstat <dom> <interface name>` command plus
seeing the interfaces names instead of "-" when doing
`virsh domiflist <dom>`.

After successful guest creation we fill the network
interfaces names based on domain, device id and append suffix
if it's emulated in the following form: vif<domid>.<devid>[-emu].
We extract the network interfaces info from the libxl_domain_config
object in libxlDomainCreateIfaceNames() to generate ifname. On domain
cleanup we also clear ifname, in case it was set by libvirt (i.e.
being prefixed with "vif"). We also skip these two steps in case the name
of the interface was manually inserted by the adminstrator.

For getting the interface statistics we resort to virNetInterfaceStats
and let libvirt handle the platform specific nits. Note that the latter
is not yet supported in FreeBSD.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
src/libxl/libxl_domain.c
src/libxl/libxl_driver.c