7bb7e3e169
virtman-memleak-disable-graph.patch virtman-memleak-callbacks.patch virtman-graph-row-spacing.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=127
161 lines
7.2 KiB
Diff
161 lines
7.2 KiB
Diff
|
|
Subject: manager: Disable graph data func if graph isn't visible
|
|
From: Cole Robinson crobinso@redhat.com Sun Sep 1 21:35:23 2013 -0400
|
|
Date: Mon Sep 2 08:42:25 2013 -0400:
|
|
Git: db7db9ab47dd00d746cf8a3359c1c26dbfcfa50e
|
|
|
|
Seems like pygobject is a bit leaky with tree row accesses, and
|
|
the cell cb hammers on that quite a bit, even if the graph isn't showing.
|
|
|
|
Index: virt-manager-0.9.5/src/virtManager/manager.py
|
|
===================================================================
|
|
--- virt-manager-0.9.5.orig/src/virtManager/manager.py
|
|
+++ virt-manager-0.9.5/src/virtManager/manager.py
|
|
@@ -249,15 +249,11 @@ class vmmManager(vmmGObjectUI):
|
|
self.config.on_stats_enable_net_poll_changed(self.enable_polling,
|
|
COL_NETWORK))
|
|
|
|
+ self.toggle_guest_cpu_usage_visible_widget()
|
|
+ self.toggle_host_cpu_usage_visible_widget()
|
|
+ self.toggle_disk_io_visible_widget()
|
|
+ self.toggle_network_traffic_visible_widget()
|
|
|
|
- self.widget("menu_view_stats_guest_cpu").set_active(
|
|
- self.config.is_vmlist_guest_cpu_usage_visible())
|
|
- self.widget("menu_view_stats_host_cpu").set_active(
|
|
- self.config.is_vmlist_host_cpu_usage_visible())
|
|
- self.widget("menu_view_stats_disk").set_active(
|
|
- self.config.is_vmlist_disk_io_visible())
|
|
- self.widget("menu_view_stats_network").set_active(
|
|
- self.config.is_vmlist_network_traffic_visible())
|
|
|
|
def init_toolbar(self):
|
|
self.widget("vm-new").set_icon_name("vm_new")
|
|
@@ -394,7 +390,7 @@ class vmmManager(vmmGObjectUI):
|
|
nameCol.add_attribute(name_txt, 'foreground-gdk', ROW_COLOR)
|
|
nameCol.set_sort_column_id(COL_NAME)
|
|
|
|
- def make_stats_column(title, datafunc, is_visible, colnum):
|
|
+ def make_stats_column(title, colnum):
|
|
col = gtk.TreeViewColumn(title)
|
|
col.set_min_width(140)
|
|
txt = gtk.CellRendererText()
|
|
@@ -406,28 +402,14 @@ class vmmManager(vmmGObjectUI):
|
|
col.pack_start(txt, False)
|
|
col.add_attribute(img, 'visible', ROW_IS_VM)
|
|
col.add_attribute(txt, 'visible', ROW_IS_CONN)
|
|
- col.set_cell_data_func(img, datafunc, None)
|
|
- col.set_visible(is_visible)
|
|
col.set_sort_column_id(colnum)
|
|
vmlist.append_column(col)
|
|
return col
|
|
|
|
- self.guestcpucol = make_stats_column(_("CPU usage"),
|
|
- self.guest_cpu_usage_img,
|
|
- self.config.is_vmlist_guest_cpu_usage_visible(),
|
|
- COL_GUEST_CPU)
|
|
- self.hostcpucol = make_stats_column(_("Host CPU usage"),
|
|
- self.host_cpu_usage_img,
|
|
- self.config.is_vmlist_host_cpu_usage_visible(),
|
|
- COL_HOST_CPU)
|
|
- self.diskcol = make_stats_column(_("Disk I/O"),
|
|
- self.disk_io_img,
|
|
- self.config.is_vmlist_disk_io_visible(),
|
|
- COL_DISK)
|
|
- self.netcol = make_stats_column(_("Network I/O"),
|
|
- self.network_traffic_img,
|
|
- self.config.is_vmlist_network_traffic_visible(),
|
|
- COL_NETWORK)
|
|
+ self.guestcpucol = make_stats_column(_("CPU usage"), COL_GUEST_CPU)
|
|
+ self.hostcpucol = make_stats_column(_("Host CPU usage"), COL_HOST_CPU)
|
|
+ self.diskcol = make_stats_column(_("Disk I/O"), COL_DISK)
|
|
+ self.netcol = make_stats_column(_("Network I/O"), COL_NETWORK)
|
|
|
|
model.set_sort_func(COL_NAME, self.vmlist_name_sorter)
|
|
model.set_sort_func(COL_GUEST_CPU, self.vmlist_guest_cpu_usage_sorter)
|
|
@@ -1163,25 +1145,33 @@ class vmmManager(vmmGObjectUI):
|
|
current_text = current_text + disabled_text
|
|
widget.set_label(current_text)
|
|
|
|
- def toggle_network_traffic_visible_widget(self, *ignore):
|
|
- val = self.config.is_vmlist_network_traffic_visible()
|
|
- self.netcol.set_visible(val)
|
|
- self.widget("menu_view_stats_network").set_active(val)
|
|
+ def _toggle_graph_helper(self, do_show, col, datafunc, menu):
|
|
+ img = -1
|
|
+ for child in col.get_cells():
|
|
+ if isinstance(child, CellRendererSparkline):
|
|
+ img = child
|
|
+ datafunc = do_show and datafunc or None
|
|
+
|
|
+ col.set_cell_data_func(img, datafunc, None)
|
|
+ col.set_visible(do_show)
|
|
+ self.widget(menu).set_active(do_show)
|
|
|
|
+ def toggle_network_traffic_visible_widget(self, *ignore):
|
|
+ self._toggle_graph_helper(
|
|
+ self.config.is_vmlist_network_traffic_visible(), self.netcol,
|
|
+ self.network_traffic_img, "menu_view_stats_network")
|
|
def toggle_disk_io_visible_widget(self, *ignore):
|
|
- val = self.config.is_vmlist_disk_io_visible()
|
|
- self.diskcol.set_visible(val)
|
|
- self.widget("menu_view_stats_disk").set_active(val)
|
|
-
|
|
+ self._toggle_graph_helper(
|
|
+ self.config.is_vmlist_disk_io_visible(), self.diskcol,
|
|
+ self.disk_io_img, "menu_view_stats_disk")
|
|
def toggle_guest_cpu_usage_visible_widget(self, *ignore):
|
|
- val = self.config.is_vmlist_guest_cpu_usage_visible()
|
|
- self.guestcpucol.set_visible(val)
|
|
- self.widget("menu_view_stats_guest_cpu").set_active(val)
|
|
-
|
|
+ self._toggle_graph_helper(
|
|
+ self.config.is_vmlist_guest_cpu_usage_visible(), self.guestcpucol,
|
|
+ self.guest_cpu_usage_img, "menu_view_stats_guest_cpu")
|
|
def toggle_host_cpu_usage_visible_widget(self, *ignore):
|
|
- val = self.config.is_vmlist_host_cpu_usage_visible()
|
|
- self.hostcpucol.set_visible(val)
|
|
- self.widget("menu_view_stats_host_cpu").set_active(val)
|
|
+ self._toggle_graph_helper(
|
|
+ self.config.is_vmlist_host_cpu_usage_visible(), self.hostcpucol,
|
|
+ self.host_cpu_usage_img, "menu_view_stats_host_cpu")
|
|
|
|
def toggle_stats_visible(self, src, stats_id):
|
|
visible = src.get_active()
|
|
@@ -1194,7 +1184,7 @@ class vmmManager(vmmGObjectUI):
|
|
set_stats[stats_id](visible)
|
|
|
|
def guest_cpu_usage_img(self, column_ignore, cell, model, _iter, data):
|
|
- obj = model.get_value(_iter, ROW_HANDLE)
|
|
+ obj = model[_iter][ROW_HANDLE]
|
|
if obj is None:
|
|
return
|
|
|
|
@@ -1202,7 +1192,7 @@ class vmmManager(vmmGObjectUI):
|
|
cell.set_property('data_array', data)
|
|
|
|
def host_cpu_usage_img(self, column_ignore, cell, model, _iter, data):
|
|
- obj = model.get_value(_iter, ROW_HANDLE)
|
|
+ obj = model[_iter][ROW_HANDLE]
|
|
if obj is None:
|
|
return
|
|
|
|
@@ -1210,7 +1200,7 @@ class vmmManager(vmmGObjectUI):
|
|
cell.set_property('data_array', data)
|
|
|
|
def disk_io_img(self, column_ignore, cell, model, _iter, data):
|
|
- obj = model.get_value(_iter, ROW_HANDLE)
|
|
+ obj = model[_iter][ROW_HANDLE]
|
|
if obj is None:
|
|
return
|
|
|
|
@@ -1221,7 +1211,7 @@ class vmmManager(vmmGObjectUI):
|
|
cell.set_property('data_array', data)
|
|
|
|
def network_traffic_img(self, column_ignore, cell, model, _iter, data):
|
|
- obj = model.get_value(_iter, ROW_HANDLE)
|
|
+ obj = model[_iter][ROW_HANDLE]
|
|
if obj is None:
|
|
return
|
|
|