Accepting request 214993 from Virtualization

Submission for os13.2 that matches SLE12 alpha3 submission

OBS-URL: https://build.opensuse.org/request/show/214993
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/virt-manager?expand=0&rev=90
This commit is contained in:
Stephan Kulow 2014-01-28 11:03:53 +00:00 committed by Git OBS Bridge
commit 8e14c418aa
6 changed files with 403 additions and 13 deletions

View File

@ -0,0 +1,235 @@
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"):

View File

@ -0,0 +1,45 @@
From 561e7318d19adaba9ea79f6f3010bc1fe9d37d10 Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Sun, 12 Jan 2014 03:13:54 +0100
Subject: [PATCH 3/3] Attempt empty path on virDomainBlockStats
libvirt for some backends yields summary domain stats for empty
disk path.
Conflicts:
virtManager/domain.py
---
virtManager/domain.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
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
@@ -196,6 +196,7 @@ class vmmDomain(vmmLibvirtObject):
self._enable_disk_poll = False
self._stats_disk_supported = True
self._stats_disk_skip = []
+ self._summary_disk_stats_skip = False
self.inspection = vmmInspectionData()
@@ -1705,6 +1706,18 @@ class vmmDomain(vmmLibvirtObject):
not self.is_active()):
return rd, wr
+ # attempt to retrieve summary stats for domain
+ if not self._summary_disk_stats_skip:
+ try:
+ io = self._backend.blockStats('')
+ if io:
+ rd = io[1]
+ wr = io[3]
+ return rd, wr
+ except libvirt.libvirtError:
+ self._summary_disk_stats_skip = True
+
+ # did not work, iterate over all disks
for disk in self.get_disk_devices(refresh_if_necc=False):
dev = disk.target
if not dev:

View File

@ -0,0 +1,66 @@
From 229c3b692e6b340951af371e0f68484bc6a8868a Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Wed, 18 Dec 2013 14:42:43 +0100
Subject: [PATCH 2/3] Base mem statistics on virDomainMemoryStats if available.
Attempt to query domain memory stats via virDomainMemoryStats.
(crobinso: remove the broken fallback, since it's confusing)
---
virtManager/domain.py | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
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
@@ -187,6 +187,8 @@ class vmmDomain(vmmLibvirtObject):
self._guest = None
self._guest_to_define = None
+ self._mem_stats_supported = True
+
self._enable_net_poll = False
self._stats_net_supported = True
self._stats_net_skip = []
@@ -1303,12 +1305,26 @@ class vmmDomain(vmmLibvirtObject):
# Stats helpers ###
###################
- def _sample_mem_stats(self, info):
- curmem = info[2]
- if not self.is_active():
- curmem = 0
+ def _sample_mem_stats(self):
+ curmem = 0
+ totalmem = 1
+
+ if self._mem_stats_supported and self.is_active():
+ try:
+ stats = self._backend.memoryStats()
+ # did we get both required stat items back?
+ if set(['actual', 'rss']).issubset(
+ set(stats.keys())):
+ curmem = stats['rss']
+ totalmem = stats['actual']
+ except libvirt.libvirtError, err:
+ if util.is_error_nosupport(err):
+ logging.debug("Mem stats not supported: %s", err)
+ self._mem_stats_supported = False
+ else:
+ logging.error("Error reading mem stats: %s", err)
- pcentCurrMem = curmem * 100.0 / self.maximum_memory()
+ pcentCurrMem = curmem * 100.0 / totalmem
pcentCurrMem = max(0.0, min(pcentCurrMem, 100.0))
return pcentCurrMem, curmem
@@ -1751,7 +1767,7 @@ class vmmDomain(vmmLibvirtObject):
(cpuTime, cpuTimeAbs,
pcentHostCpu, pcentGuestCpu) = self._sample_cpu_stats(info, now)
- pcentCurrMem, curmem = self._sample_mem_stats(info)
+ pcentCurrMem, curmem = self._sample_mem_stats()
rdBytes, wrBytes = self._sample_disk_io()
rxBytes, txBytes = self._sample_network_traffic()

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Wed Jan 23 18:00:00 CET 2014 - tbehrens@suse.com
- Fate#313213: pending upstream patches added
* 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
-------------------------------------------------------------------
Wed Jan 22 11:03:50 MST 2014 - carnold@suse.com
- Add Requires on virt-manager for virt-install
- Add sles12/sled12 as supported distros
-------------------------------------------------------------------
Thu Jan 07 14:25:13 MDT 2014 - carnold@suse.com

View File

@ -62,13 +62,18 @@ Patch157: virtinst-detect-suse-distros.patch
Patch158: virtinst-allow-ide-hdb.patch
Patch159: virtinst-xen-drive-type.patch
Patch160: virtinst-clone-disks.patch
# Pending upstream
Patch200: Add-memory-stats-widget-also-to-manager-tree-view.patch
Patch201: Base-mem-statistics-on-virDomainMemoryStats-if-avail.patch
Patch202: Attempt-empty-path-on-virDomainBlockStats.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define verrel %{version}-%{release}
Requires: virt-manager-common = %{verrel}
Requires: gtk3
Requires: python-gconf
Requires: virt-manager-common = %{verrel}
Requires: vm-install >= 0.5.6
# Libvirt-glib
@ -83,13 +88,15 @@ Requires: typelib-1_0-Vte-2_90
Requires: gtk-vnc2
Requires: libspice-client-glib-2_0-8
Requires: libspice-client-gtk-3_0-4
Requires: typelib-1_0-GVnc-1_0
Requires: typelib-1_0-Gtk-3_0
Requires: typelib-1_0-GtkVnc-2_0
Requires: typelib-1_0-SpiceClientGlib-2_0
Requires: typelib-1_0-SpiceClientGtk-3_0
Requires: typelib-1_0-Gtk-3_0
Requires: typelib-1_0-GVnc-1_0
Requires: typelib-1_0-GtkVnc-2_0
Recommends: python-SpiceClientGtk
Requires: virt-install
%if %{with_guestfs}
Requires: python-libguestfs
%endif
@ -114,8 +121,8 @@ Group: System/Monitoring
# This version not strictly required: virt-manager should work with older,
# however varying amounts of functionality will not be enabled.
Requires: libvirt-python >= 0.7.0
Requires: python-ipaddr
Requires: python-urlgrabber
Requires: python-ipaddr
%description common
Common files used by the different virt-manager interfaces, as well as
@ -128,10 +135,10 @@ Group: System/Monitoring
Requires: virt-manager-common = %{verrel}
Provides: python-virtinst
Provides: virt-clone
Provides: virt-convert
Provides: virt-image
Provides: virt-convert
Provides: python-virtinst
Obsoletes: python-virtinst <= 0.600.4
%description -n virt-install
@ -169,6 +176,9 @@ machine).
%patch158 -p1
%patch159 -p1
%patch160 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1
%build
%if %{qemu_user}

View File

@ -2,7 +2,7 @@ Index: virt-manager-0.10.0/virtinst/osdict.py
===================================================================
--- virt-manager-0.10.0.orig/virtinst/osdict.py
+++ virt-manager-0.10.0/virtinst/osdict.py
@@ -408,33 +408,93 @@ OS_TYPES = {
@@ -408,33 +408,113 @@ OS_TYPES = {
},
"opensuse11": {
@ -81,6 +81,16 @@ Index: virt-manager-0.10.0/virtinst/osdict.py
+ NET : VIRTIO_NET,
+ },
+ },
+ "sles12": {
+ "label": "Suse Linux Enterprise Server 12",
+ "distro": "suse",
+ "supported": True,
+ "pv_cdrom_install": True,
+ "devices" : {
+ DISK : VIRTIO_DISK,
+ NET : VIRTIO_NET,
+ },
+ },
+
+ "sled10": {
+ "label": "Suse Linux Enterprise Desktop 10",
@ -95,11 +105,21 @@ Index: virt-manager-0.10.0/virtinst/osdict.py
+ "label": "Suse Linux Enterprise Desktop 11",
+ "distro": "suse",
+ "supported": True,
+ "pv_cdrom_install": True,
+ "devices" : {
+ DISK : VIRTIO_DISK,
+ NET : VIRTIO_NET,
+ },
+ },
+ "sled12": {
+ "label": "Suse Linux Enterprise Desktop 12",
+ "distro": "suse",
+ "supported": True,
+ "pv_cdrom_install": True,
"devices" : {
DISK : VIRTIO_DISK,
NET : VIRTIO_NET,
@@ -619,6 +679,12 @@ OS_TYPES = {
@@ -619,6 +699,12 @@ OS_TYPES = {
VIDEO : VMVGA_VIDEO,
},
},
@ -112,7 +132,7 @@ Index: virt-manager-0.10.0/virtinst/osdict.py
"generic24": {
"label": "Generic 2.4.x kernel"
@@ -682,6 +748,12 @@ OS_TYPES = {
@@ -682,6 +768,12 @@ OS_TYPES = {
"sortby": "mswinserv2008",
"distro": "winserv",
},
@ -125,7 +145,7 @@ Index: virt-manager-0.10.0/virtinst/osdict.py
"vista": {
"label": "Microsoft Windows Vista",
"supported": True,
@@ -694,6 +766,12 @@ OS_TYPES = {
@@ -694,6 +786,12 @@ OS_TYPES = {
"sortby": "mswin7",
"distro": "win",
},
@ -138,7 +158,7 @@ Index: virt-manager-0.10.0/virtinst/osdict.py
},
},
@@ -770,6 +848,13 @@ OS_TYPES = {
@@ -770,6 +868,13 @@ OS_TYPES = {
"apic": False,
},
@ -152,7 +172,7 @@ Index: virt-manager-0.10.0/virtinst/osdict.py
"netware4": {
"label": "Novell Netware 4",
},
@@ -778,6 +863,7 @@ OS_TYPES = {
@@ -778,6 +883,7 @@ OS_TYPES = {
},
"netware6": {
"label": "Novell Netware 6",