77fdd82 libxl: implement virDomainInterfaceStats

2 files Authored by Joao Martins 8 years ago, Committed by Jim Fehlig 8 years ago,
    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>
    
        
file modified
+39 -0
file modified
+52 -0