[Libvir] [PATCH] Block device and network stats

Daniel P. Berrange berrange at redhat.com
Fri Aug 10 14:51:17 UTC 2007


On Fri, Aug 10, 2007 at 03:35:08PM +0100, Richard W.M. Jones wrote:
> This is the implementation (currently Xen, local only).
> 
> It includes a couple of virsh commands if you want to play with looking 
> at the stats.

The network interface stuff isn't quiet correct

+/* Paths have the form "virbr\d+" or "xenbr\d+".  On Linux we open
+ * /proc/net/dev and look for the device called vif<domid>.<n>.
+ */
+int
+xenHypervisorDomainInterfaceStats (virDomainPtr dom,
+                                   const char *path,
+                                   struct _virDomainInterfaceStats *stats)


The virbrN  / xenbrN devices are bridges so see all traffic from any guest
attached.  We need to look at ths individual  vifN.N or vnetN devices which
are per-guest.  This info isn't included in the XML though. If we can figure
out a efficient way to export vif name in the XML we could use that, otherwie
the API should probably take the MAC address on the device and use that to
resolve the underlying VIF. The former is nicer though if we can do it.


That all said, it could be nice to also have a getStats method for the
virNetworkPtr objects to get cummulative bridge data - the backend impl
would be near identical.

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list