FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora/Linux Management Tools

 
 
LinkBack Thread Tools
 
Old 10-06-2008, 10:37 AM
"Daniel P. Berrange"
 
Default : 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

try:
io = self.vm.interfaceStats(netdev[2])
except:
pass
if io:
rx += io[0]
tx += io[4]

> + return rx, tx
> +
> + def _disk_io(self):
> + rd = 0
> + wr = 0
> + for disk in self.get_disk_devices():
> + io = self.vm.blockStats(disk[3])
> + if io:
> + rd += io[1]
> + wr += io[3]
> + return rd, wr


Likewise here.

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
 
Old 10-07-2008, 01:11 PM
Guido GŁnther
 
Default : 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
 

Thread Tools




All times are GMT. The time now is 12:13 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org