: virt-manager: block device and network statistics
On Sat, Oct 04, 2008 at 10:24:25PM +0200, Guido G?nther wrote:
> This is the actual patch to calculate the block and net stats:
>
> Display block device I/0 and network I/O in the overview as well as in
> the vm details. The sparkline widget in the vm overview only draws the
> rx and read rates.This is fixed up by a followup patch, since this way
> we're independent of the sparkline patches.
> diff -r 30dc0d5939d4 src/virtManager/domain.py
> --- a/src/virtManager/domain.py Sat Oct 04 20:41:20 2008 +0200
> +++ b/src/virtManager/domain.py Sat Oct 04 21:52:04 2008 +0200
> @@ -149,6 +155,34 @@
> self.lastStatus = status
> self.emit("status-changed", status)
>
> + def _network_traffic(self):
> + rx = 0
> + tx = 0
> + for netdev in self.get_network_devices():
> + io = self.vm.interfaceStats(netdev[2])
> + if io:
> + rx += io[0]
> + tx += io[4]
The standard behaviour libvirt python binding is to raise an exception
if something fails, so checking for io == None isn't sufficient here.
You should also wrap the call
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
10-07-2008, 01:11 PM
Guido Günther
: virt-manager: block device and network statistics
On Mon, Oct 06, 2008 at 11:37:42AM +0100, Daniel P. Berrange wrote:
[..snip..]
> The standard behaviour libvirt python binding is to raise an exception
> if something fails, so checking for io == None isn't sufficient here.
> You should also wrap the call
Updated version attached.
-- Guido
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools