Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora/Linux Management Tools (http://www.linux-archive.org/fedora-linux-management-tools/)
-   -   : virt-manager: add sparcline to vm/connection overview (http://www.linux-archive.org/fedora-linux-management-tools/170832-virt-manager-add-sparcline-vm-connection-overview.html)

Guido GŁnther 10-04-2008 08:30 PM

: virt-manager: add sparcline to vm/connection overview
 
Finally display a combined sparcline for rx & tx (network) and input &
output (disk) in the Network I/O and Disk I/O columns in the vm machine
overview.
-- Guido

diff -r 134368ad3def src/virtManager/connection.py
--- a/src/virtManager/connection.py Sat Oct 04 17:04:56 2008 +0200
+++ b/src/virtManager/connection.py Sat Oct 04 17:27:01 2008 +0200
@@ -1056,6 +1056,14 @@

def disk_io_rate(self):
return self.disk_read_rate() + self.disk_write_rate()
+
+ def disk_io_vector_limit(self, dummy):
+ """No point to accumulate unnormalized I/O for a conenction"""
+ return [ 0.0 ]
+
+ def network_traffic_vector_limit(self, dummy):
+ """No point to accumulate unnormalized Rx/Tx for a conenction"""
+ return [ 0.0 ]

def uuidstr(self, rawuuid):
hex = ['0','1','2','3','4','5','6','7','8','9','a','b','c ','d','e','f']
diff -r 134368ad3def src/virtManager/domain.py
--- a/src/virtManager/domain.py Sat Oct 04 17:04:56 2008 +0200
+++ b/src/virtManager/domain.py Sat Oct 04 17:27:01 2008 +0200
@@ -422,6 +422,14 @@
vector.append(0)
return vector

+ def in_out_vector_limit(self, data, limit):
+ l = len(data)/2
+ end = [l, limit][l > limit]
+ if l > limit:
+ data = data[0:end] + data[l:l+end]
+ d = map(lambda x,y: (x + y)/2, data[0:end], data[l:l+end])
+ return d
+
def network_traffic_vector(self):
vector = []
stats = self.record
@@ -434,6 +442,9 @@
vector.append(0.0)
return vector

+ def network_traffic_vector_limit(self, limit):
+ return self.in_out_vector_limit(self.network_traffic_vect or(), limit)
+
def disk_io_vector(self):
vector = []
stats = self.record
@@ -445,6 +456,9 @@
else:
vector.append(0.0)
return vector
+
+ def disk_io_vector_limit(self, limit):
+ return self.in_out_vector_limit(self.disk_io_vector(), limit)

def shutdown(self):
self.vm.shutdown()
diff -r 134368ad3def src/virtManager/manager.py
--- a/src/virtManager/manager.py Sat Oct 04 17:04:56 2008 +0200
+++ b/src/virtManager/manager.py Sat Oct 04 17:27:01 2008 +0200
@@ -863,6 +863,7 @@

cpuUsage_txt = gtk.CellRendererText()
cpuUsage_img = sparkline.CellRendererSparkline()
+ cpuUsage_img.set_property("reversed", True)
cpuUsageCol.pack_start(cpuUsage_txt, False)
cpuUsageCol.pack_start(cpuUsage_img, False)
cpuUsageCol.add_attribute(cpuUsage_txt, 'text', ROW_CPU)
@@ -886,19 +887,27 @@

diskIOIn_txt = gtk.CellRendererText()
diskIOOut_txt = gtk.CellRendererText()
+ diskIO_img = sparkline.CellRendererSparkline()
+ diskIO_img.set_property("reversed", True)
diskIOCol.pack_start(diskIOIn_txt, False)
diskIOCol.pack_start(diskIOOut_txt, False)
+ diskIOCol.pack_start(diskIO_img, False)
diskIOCol.add_attribute(diskIOIn_txt, 'text', ROW_DISK_RD)
diskIOCol.add_attribute(diskIOOut_txt, 'text', ROW_DISK_WR)
+ diskIOCol.set_cell_data_func(diskIO_img, self.disk_io_img, None)
diskIOCol.set_visible(self.config.is_vmlist_disk_i o_visible())
diskIOCol.set_sort_column_id(VMLIST_SORT_DISK_IO)

networkTrafficIn_txt = gtk.CellRendererText()
networkTrafficOut_txt = gtk.CellRendererText()
+ networkTraffic_img = sparkline.CellRendererSparkline()
+ networkTraffic_img.set_property("reversed", True)
networkTrafficCol.pack_start(networkTrafficIn_txt, False)
networkTrafficCol.pack_start(networkTrafficOut_txt , False)
+ networkTrafficCol.pack_start(networkTraffic_img, False)
networkTrafficCol.add_attribute(networkTrafficIn_t xt, 'text', ROW_NET_RX)
networkTrafficCol.add_attribute(networkTrafficOut_ txt, 'text', ROW_NET_TX)
+ networkTrafficCol.set_cell_data_func(networkTraffi c_img, self.network_traffic_img, None)
networkTrafficCol.set_visible(self.config.is_vmlis t_network_traffic_visible())
networkTrafficCol.set_sort_column_id(VMLIST_SORT_N ETWORK_USAGE)

@@ -997,7 +1006,18 @@
if model.get_value(iter, ROW_HANDLE) is None:
return
data = model.get_value(iter, ROW_HANDLE).cpu_time_vector_limit(40)
- data.reverse()
+ cell.set_property('data_array', data)
+
+ def disk_io_img(self, column, cell, model, iter, data):
+ if model.get_value(iter, ROW_HANDLE) is None:
+ return
+ data = model.get_value(iter, ROW_HANDLE).disk_io_vector_limit(40)
+ cell.set_property('data_array', data)
+
+ def network_traffic_img(self, column, cell, model, iter, data):
+ if model.get_value(iter, ROW_HANDLE) is None:
+ return
+ data = model.get_value(iter, ROW_HANDLE).network_traffic_vector_limit(40)
cell.set_property('data_array', data)

def start_vm(self, ignore):
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

"Daniel P. Berrange" 10-06-2008 11:04 AM

: virt-manager: add sparcline to vm/connection overview
 
On Sat, Oct 04, 2008 at 10:30:46PM +0200, Guido G?nther wrote:
> Finally display a combined sparcline for rx & tx (network) and input &
> output (disk) in the Network I/O and Disk I/O columns in the vm machine
> overview.

ACK

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

Cole Robinson 10-09-2008 04:45 PM

: virt-manager: add sparcline to vm/connection overview
 
Guido GŁnther wrote:
> Finally display a combined sparcline for rx & tx (network) and input &
> output (disk) in the Network I/O and Disk I/O columns in the vm machine
> overview.
> -- Guido
>
> diff -r 134368ad3def src/virtManager/connection.py
> --- a/src/virtManager/connection.py Sat Oct 04 17:04:56 2008 +0200
> +++ b/src/virtManager/connection.py Sat Oct 04 17:27:01 2008 +0200
> @@ -1056,6 +1056,14 @@
>
> def disk_io_rate(self):
> return self.disk_read_rate() + self.disk_write_rate()
> +
> + def disk_io_vector_limit(self, dummy):
> + """No point to accumulate unnormalized I/O for a conenction"""
> + return [ 0.0 ]
> +
> + def network_traffic_vector_limit(self, dummy):
> + """No point to accumulate unnormalized Rx/Tx for a conenction"""
> + return [ 0.0 ]
>
> def uuidstr(self, rawuuid):
> hex = ['0','1','2','3','4','5','6','7','8','9','a','b','c ','d','e','f']
> diff -r 134368ad3def src/virtManager/domain.py
> --- a/src/virtManager/domain.py Sat Oct 04 17:04:56 2008 +0200
> +++ b/src/virtManager/domain.py Sat Oct 04 17:27:01 2008 +0200
> @@ -422,6 +422,14 @@
> vector.append(0)
> return vector
>
> + def in_out_vector_limit(self, data, limit):
> + l = len(data)/2
> + end = [l, limit][l > limit]
> + if l > limit:
> + data = data[0:end] + data[l:l+end]

This piece here was giving me some trouble. If we
shrink data here, then the line below will try to
grab an out of bound index.

> + d = map(lambda x,y: (x + y)/2, data[0:end], data[l:l+end])

Maybe this should be ... data[0:end], data[end:end*2] or
similar.

Also, the scaling problems with the disk polling can be
_really_ bad (though it's no fault of the code). If I have
polling going once a second, and single guest running with
six disks and a nic, the UI is completely locked up.

So I'd like to hold off on committing the actual polling
work until we put the gconf values in to disable this. It
doesn't even need to wired up to the gui for now, I can
do that after this its committed if you'd like (the prefs
dialog needs an overhaul anyways, but that can come after).

Thanks,
Cole

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

Guido GŁnther 10-18-2008 07:51 PM

: virt-manager: add sparcline to vm/connection overview
 
Hi,
Display a combined sparcline for rx & tx (network) and input & output
(disk) in the Network I/O and Disk I/O columns in the vm machine
overview. Bounds fixed as suggested by Cole.
-- Guido

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools


All times are GMT. The time now is 02:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.