]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libxl: implement virDomainInterfaceStats
authorJoao Martins <joao.m.martins@oracle.com>
Wed, 24 Feb 2016 13:25:46 +0000 (13:25 +0000)
committerJim Fehlig <jfehlig@suse.com>
Wed, 24 Feb 2016 21:28:57 +0000 (14:28 -0700)
commit77fdd82e51efcc2d717cb339e390cb222370616d
treee13447673eb458f7ad35fb4616627b218fae7d81
parent5c79c445c2e15d72a00940cf628d3295cbcb9e58
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 administrator. Since the
introduction of netprefix (commit a040ba9), ifnames with a registered
prefix will be freed on virDomain{Obj,Def}Format*, thus eliminating
the migration issues observed with the reverted commit d2e5538 whereas
source and destination would have the same ifname.

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