10933e4552
* added Add-memory-stats-widget-also-to-manager-tree-view.patch * added Base-mem-statistics-on-virDomainMemoryStats-if-avail.patch * added Attempt-empty-path-on-virDomainBlockStats.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=137
236 lines
11 KiB
Diff
236 lines
11 KiB
Diff
From 43f0549e2f4e1479cf3e9fe9201a8224eb5b56a1 Mon Sep 17 00:00:00 2001
|
|
From: Thorsten Behrens <tbehrens@suse.com>
|
|
Date: Wed, 18 Dec 2013 14:42:42 +0100
|
|
Subject: [PATCH 1/3] Add memory stats widget also to manager tree view.
|
|
|
|
(crobinso: Fix an initialization issue)
|
|
|
|
Conflicts:
|
|
virtManager/manager.py
|
|
---
|
|
data/org.virt-manager.virt-manager.gschema.xml | 6 ++++
|
|
ui/vmm-manager.ui | 9 ++++++
|
|
virtManager/config.py | 6 ++++
|
|
virtManager/domain.py | 3 ++
|
|
virtManager/manager.py | 41 ++++++++++++++++++++++++--
|
|
5 files changed, 62 insertions(+), 3 deletions(-)
|
|
|
|
Index: virt-manager-0.10.0/data/org.virt-manager.virt-manager.gschema.xml
|
|
===================================================================
|
|
--- virt-manager-0.10.0.orig/data/org.virt-manager.virt-manager.gschema.xml
|
|
+++ virt-manager-0.10.0/data/org.virt-manager.virt-manager.gschema.xml
|
|
@@ -94,6 +94,12 @@
|
|
<description>Show the host cpu usage field in the domain list summary view</description>
|
|
</key>
|
|
|
|
+ <key name="memory-usage" type="b">
|
|
+ <default>false</default>
|
|
+ <summary>Show memory usage in summary</summary>
|
|
+ <description>Show memory usage field in the domain list summary view</description>
|
|
+ </key>
|
|
+
|
|
</schema>
|
|
|
|
<schema id="org.virt-manager.virt-manager.stats" path="/org/virt-manager/virt-manager/stats/">
|
|
Index: virt-manager-0.10.0/ui/vmm-manager.ui
|
|
===================================================================
|
|
--- virt-manager-0.10.0.orig/ui/vmm-manager.ui
|
|
+++ virt-manager-0.10.0/ui/vmm-manager.ui
|
|
@@ -190,6 +190,15 @@
|
|
</object>
|
|
</child>
|
|
<child>
|
|
+ <object class="GtkCheckMenuItem" id="menu_view_stats_memory">
|
|
+ <property name="visible">True</property>
|
|
+ <property name="can_focus">False</property>
|
|
+ <property name="label" translatable="yes">_Memory Usage</property>
|
|
+ <property name="use_underline">True</property>
|
|
+ <signal name="activate" handler="on_menu_view_memory_usage_activate" swapped="no"/>
|
|
+ </object>
|
|
+ </child>
|
|
+ <child>
|
|
<object class="GtkCheckMenuItem" id="menu_view_stats_disk">
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">False</property>
|
|
Index: virt-manager-0.10.0/virtManager/config.py
|
|
===================================================================
|
|
--- virt-manager-0.10.0.orig/virtManager/config.py
|
|
+++ virt-manager-0.10.0/virtManager/config.py
|
|
@@ -251,6 +251,8 @@ class vmmConfig(object):
|
|
return self.conf.get("/vmlist-fields/cpu-usage")
|
|
def is_vmlist_host_cpu_usage_visible(self):
|
|
return self.conf.get("/vmlist-fields/host-cpu-usage")
|
|
+ def is_vmlist_memory_usage_visible(self):
|
|
+ return self.conf.get("/vmlist-fields/memory-usage")
|
|
def is_vmlist_disk_io_visible(self):
|
|
return self.conf.get("/vmlist-fields/disk-usage")
|
|
def is_vmlist_network_traffic_visible(self):
|
|
@@ -260,6 +262,8 @@ class vmmConfig(object):
|
|
self.conf.set("/vmlist-fields/cpu-usage", state)
|
|
def set_vmlist_host_cpu_usage_visible(self, state):
|
|
self.conf.set("/vmlist-fields/host-cpu-usage", state)
|
|
+ def set_vmlist_memory_usage_visible(self, state):
|
|
+ self.conf.set("/vmlist-fields/memory-usage", state)
|
|
def set_vmlist_disk_io_visible(self, state):
|
|
self.conf.set("/vmlist-fields/disk-usage", state)
|
|
def set_vmlist_network_traffic_visible(self, state):
|
|
@@ -269,6 +273,8 @@ class vmmConfig(object):
|
|
return self.conf.notify_add("/vmlist-fields/cpu-usage", cb)
|
|
def on_vmlist_host_cpu_usage_visible_changed(self, cb):
|
|
return self.conf.notify_add("/vmlist-fields/host-cpu-usage", cb)
|
|
+ def on_vmlist_memory_usage_visible_changed(self, cb):
|
|
+ return self.conf.notify_add("/vmlist-fields/memory-usage", cb)
|
|
def on_vmlist_disk_io_visible_changed(self, cb):
|
|
return self.conf.notify_add("/vmlist-fields/disk-usage", cb)
|
|
def on_vmlist_network_traffic_visible_changed(self, cb):
|
|
Index: virt-manager-0.10.0/virtManager/domain.py
|
|
===================================================================
|
|
--- virt-manager-0.10.0.orig/virtManager/domain.py
|
|
+++ virt-manager-0.10.0/virtManager/domain.py
|
|
@@ -1475,6 +1475,9 @@ class vmmDomain(vmmLibvirtObject):
|
|
if len(cpudata) > limit:
|
|
cpudata = cpudata[0:limit]
|
|
return cpudata
|
|
+ def memory_usage_vector_limit(self, limit):
|
|
+ return self.in_out_vector_limit(self.stats_memory_vector(),
|
|
+ limit)
|
|
def network_traffic_vector_limit(self, limit, ceil=None):
|
|
return self.in_out_vector_limit(self.network_traffic_vector(ceil),
|
|
limit)
|
|
Index: virt-manager-0.10.0/virtManager/manager.py
|
|
===================================================================
|
|
--- virt-manager-0.10.0.orig/virtManager/manager.py
|
|
+++ virt-manager-0.10.0/virtManager/manager.py
|
|
@@ -58,8 +58,9 @@ ROW_INSPECTION_OS_ICON) = range(13)
|
|
COL_NAME = 0
|
|
COL_GUEST_CPU = 1
|
|
COL_HOST_CPU = 2
|
|
-COL_DISK = 3
|
|
-COL_NETWORK = 4
|
|
+COL_MEM = 3
|
|
+COL_DISK = 4
|
|
+COL_NETWORK = 5
|
|
|
|
|
|
try:
|
|
@@ -128,6 +129,7 @@ class vmmManager(vmmGObjectUI):
|
|
# list.get_column, so avoid it
|
|
self.diskcol = None
|
|
self.netcol = None
|
|
+ self.memcol = None
|
|
self.guestcpucol = None
|
|
self.hostcpucol = None
|
|
|
|
@@ -136,6 +138,8 @@ class vmmManager(vmmGObjectUI):
|
|
self.toggle_stats_visible_guest_cpu,
|
|
"on_menu_view_host_cpu_usage_activate":
|
|
self.toggle_stats_visible_host_cpu,
|
|
+ "on_menu_view_memory_usage_activate":
|
|
+ self.toggle_stats_visible_memory_usage,
|
|
"on_menu_view_disk_io_activate" :
|
|
self.toggle_stats_visible_disk,
|
|
"on_menu_view_network_traffic_activate":
|
|
@@ -224,6 +228,7 @@ class vmmManager(vmmGObjectUI):
|
|
|
|
self.diskcol = None
|
|
self.guestcpucol = None
|
|
+ self.memcol = None
|
|
self.hostcpucol = None
|
|
self.netcol = None
|
|
|
|
@@ -256,6 +261,9 @@ class vmmManager(vmmGObjectUI):
|
|
self.config.on_vmlist_host_cpu_usage_visible_changed(
|
|
self.toggle_host_cpu_usage_visible_widget))
|
|
self.add_gconf_handle(
|
|
+ self.config.on_vmlist_memory_usage_visible_changed(
|
|
+ self.toggle_memory_usage_visible_widget))
|
|
+ self.add_gconf_handle(
|
|
self.config.on_vmlist_disk_io_visible_changed(
|
|
self.toggle_disk_io_visible_widget))
|
|
self.add_gconf_handle(
|
|
@@ -271,7 +279,6 @@ class vmmManager(vmmGObjectUI):
|
|
self.config.on_stats_enable_net_poll_changed(self.enable_polling,
|
|
COL_NETWORK))
|
|
|
|
-
|
|
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(
|
|
@@ -460,6 +467,10 @@ class vmmManager(vmmGObjectUI):
|
|
self.host_cpu_usage_img,
|
|
self.config.is_vmlist_host_cpu_usage_visible(),
|
|
COL_HOST_CPU)
|
|
+ self.memcol = make_stats_column(_("Memory usage"),
|
|
+ self.memory_usage_img,
|
|
+ self.config.is_vmlist_memory_usage_visible(),
|
|
+ COL_MEM)
|
|
self.diskcol = make_stats_column(_("Disk I/O"),
|
|
self.disk_io_img,
|
|
self.config.is_vmlist_disk_io_visible(),
|
|
@@ -472,6 +483,7 @@ class vmmManager(vmmGObjectUI):
|
|
model.set_sort_func(COL_NAME, self.vmlist_name_sorter)
|
|
model.set_sort_func(COL_GUEST_CPU, self.vmlist_guest_cpu_usage_sorter)
|
|
model.set_sort_func(COL_HOST_CPU, self.vmlist_host_cpu_usage_sorter)
|
|
+ model.set_sort_func(COL_MEM, self.vmlist_memory_usage_sorter)
|
|
model.set_sort_func(COL_DISK, self.vmlist_disk_io_sorter)
|
|
model.set_sort_func(COL_NETWORK, self.vmlist_network_usage_sorter)
|
|
model.set_sort_column_id(COL_NAME, Gtk.SortType.ASCENDING)
|
|
@@ -1162,6 +1174,13 @@ class vmmManager(vmmGObjectUI):
|
|
return cmp(obj1.host_cpu_time_percentage(),
|
|
obj2.host_cpu_time_percentage())
|
|
|
|
+ def vmlist_memory_usage_sorter(self, model, iter1, iter2, ignore):
|
|
+ obj1 = model.get_value(iter1, ROW_HANDLE)
|
|
+ obj2 = model.get_value(iter2, ROW_HANDLE)
|
|
+
|
|
+ return cmp(obj1.stats_memory(),
|
|
+ obj2.stats_memory())
|
|
+
|
|
def vmlist_disk_io_sorter(self, model, iter1, iter2, ignore):
|
|
obj1 = model.get_value(iter1, ROW_HANDLE)
|
|
obj2 = model.get_value(iter2, ROW_HANDLE)
|
|
@@ -1211,6 +1230,11 @@ class vmmManager(vmmGObjectUI):
|
|
self.diskcol.set_visible(val)
|
|
self.widget("menu_view_stats_disk").set_active(val)
|
|
|
|
+ def toggle_memory_usage_visible_widget(self):
|
|
+ val = self.config.is_vmlist_memory_usage_visible()
|
|
+ self.memcol.set_visible(val)
|
|
+ self.widget("menu_view_stats_memory").set_active(val)
|
|
+
|
|
def toggle_guest_cpu_usage_visible_widget(self):
|
|
val = self.config.is_vmlist_guest_cpu_usage_visible()
|
|
self.guestcpucol.set_visible(val)
|
|
@@ -1226,6 +1250,7 @@ class vmmManager(vmmGObjectUI):
|
|
set_stats = {
|
|
COL_GUEST_CPU: self.config.set_vmlist_guest_cpu_usage_visible,
|
|
COL_HOST_CPU: self.config.set_vmlist_host_cpu_usage_visible,
|
|
+ COL_MEM: self.config.set_vmlist_memory_usage_visible,
|
|
COL_DISK: self.config.set_vmlist_disk_io_visible,
|
|
COL_NETWORK: self.config.set_vmlist_network_traffic_visible,
|
|
}
|
|
@@ -1235,6 +1260,8 @@ class vmmManager(vmmGObjectUI):
|
|
self.toggle_stats_visible(src, COL_GUEST_CPU)
|
|
def toggle_stats_visible_host_cpu(self, src):
|
|
self.toggle_stats_visible(src, COL_HOST_CPU)
|
|
+ def toggle_stats_visible_memory_usage(self, src):
|
|
+ self.toggle_stats_visible(src, COL_MEM)
|
|
def toggle_stats_visible_disk(self, src):
|
|
self.toggle_stats_visible(src, COL_DISK)
|
|
def toggle_stats_visible_network(self, src):
|
|
@@ -1256,6 +1283,14 @@ class vmmManager(vmmGObjectUI):
|
|
data = obj.host_cpu_time_vector_limit(GRAPH_LEN)
|
|
cell.set_property('data_array', data)
|
|
|
|
+ def memory_usage_img(self, column_ignore, cell, model, _iter, data):
|
|
+ obj = model[_iter][ROW_HANDLE]
|
|
+ if obj is None or not hasattr(obj, "conn"):
|
|
+ return
|
|
+
|
|
+ data = obj.memory_usage_vector_limit(GRAPH_LEN)
|
|
+ cell.set_property('data_array', data)
|
|
+
|
|
def disk_io_img(self, column_ignore, cell, model, _iter, data):
|
|
obj = model.get_value(_iter, ROW_HANDLE)
|
|
if obj is None or not hasattr(obj, "conn"):
|