[libvirt] [PATCH 0/2] Implement interface stats for BSD

Roman Bogorodskiy bogorodskiy at gmail.com
Sun Jul 6 16:28:42 UTC 2014


This series implements support for querying network interface
stats on (Free)BSD.

It's more of an RFC, because I'm uncertain about few things:

 - It feels a little strange to have a source file that implements 
   only a single function  like this. I am wondering if it would be better
   to just move it to something like util/virnetdev.c?
 - FreeBSD stores interface data in the if_data struct and a number of outgoing
   packet drops is stored in a field 'ifi_oqdrops'. This field was added
   in -CURRENT and later merged back to 10-STABLE. In order not to break
   the ABI, it's available only if _IFI_OQDROPS is defined. I've added
   a configure.ac check which adds -D_IFI_OQDROPS before checking this field
   and resetting it back if it is not present. This way, this flag will
   present when the field is available even if the flag is not needed
   (e.g. on -CURRENT). Is there a better way of doing it? I was thinking
   about trying to check this field without the flag and if it fails check
   one more time with the flag, but it looks a little messy.
 - Did I get it right that the stats reported are from the guest POV, e.g.
   when downloading a large file from guest, it should look like:

	vnet0 rx_bytes 731603341
	vnet0 rx_packets 518354
	vnet0 rx_errs 0
	vnet0 rx_drop 0
	vnet0 tx_bytes 17577834
	vnet0 tx_packets 264226
	vnet0 tx_errs 0
	vnet0 tx_drop 0 

Roman Bogorodskiy (2):
  util: virstatslinux: make more generic
  Implement interface stats for BSD

 configure.ac                             | 13 ++++-
 po/POTFILES.in                           |  2 +-
 src/Makefile.am                          |  2 +-
 src/libvirt_linux.syms                   |  3 --
 src/libvirt_private.syms                 |  2 +
 src/lxc/lxc_driver.c                     |  2 +-
 src/openvz/openvz_driver.c               |  2 +-
 src/qemu/qemu_driver.c                   | 16 +-----
 src/uml/uml_driver.c                     |  2 +-
 src/util/{virstatslinux.c => virstats.c} | 93 +++++++++++++++++++++++++-------
 src/util/{virstatslinux.h => virstats.h} | 12 ++---
 src/xen/xen_hypervisor.c                 |  2 +-
 tests/statstest.c                        |  2 +-
 13 files changed, 102 insertions(+), 51 deletions(-)
 rename src/util/{virstatslinux.c => virstats.c} (61%)
 rename src/util/{virstatslinux.h => virstats.h} (77%)

-- 
1.9.0




More information about the libvir-list mailing list