[python-virtinst/f15/master] Don't parse spice channel XML as a <channel> device Properly advertise spicevmc options for use by v
Cole Robinson
crobinso at fedoraproject.org
Thu Apr 7 13:20:47 UTC 2011
commit beb0076bf656b5f34554fb4bec3fa2d1188ff8de
Author: Cole Robinson <crobinso at redhat.com>
Date: Thu Apr 7 08:54:01 2011 -0400
Don't parse spice channel XML as a <channel> device
Properly advertise spicevmc options for use by virt-manager
python-virtinst.spec | 12 +++-
virtinst-fix-channel-parse.patch | 20 ++++++
virtinst-spicevmc-fixes.patch | 126 ++++++++++++++++++++++++++++++++++++++
3 files changed, 157 insertions(+), 1 deletions(-)
---
diff --git a/python-virtinst.spec b/python-virtinst.spec
index b73b806..bb92508 100644
--- a/python-virtinst.spec
+++ b/python-virtinst.spec
@@ -20,8 +20,12 @@
Summary: Python modules and utilities for installing virtual machines
Name: python-%{appname}
Version: 0.500.6
-Release: 1%{_extra_release}
+Release: 2%{_extra_release}
Source0: http://virt-manager.org/download/sources/%{appname}/%{appname}-%{version}.tar.gz
+# Don't parse spice channel XML as a <channel> device
+Patch1: %{appname}-fix-channel-parse.patch
+# Properly advertise spicevmc options for use by virt-manager
+Patch2: %{appname}-spicevmc-fixes.patch
License: GPLv2+
Group: Development/Libraries
@@ -49,6 +53,8 @@ and install new VMs) and virt-clone (clone an existing virtual machine).
%prep
%setup -q -n %{appname}-%{version}
+%patch1 -p1
+%patch2 -p1
%build
python setup.py build
@@ -79,6 +85,10 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/virt-convert
%changelog
+* Thu Apr 07 2011 Cole Robinson <crobinso at redhat.com> - 0.500.6-2.fc15
+- Don't parse spice channel XML as a <channel> device
+- Properly advertise spicevmc options for use by virt-manager
+
* Mon Mar 28 2011 Cole Robinson <crobinso at redhat.com> - 0.500.6-1.fc15
- Rebased to version 0.500.6
- virt-install: --graphics spice now enables spicevmc and qxl
diff --git a/virtinst-fix-channel-parse.patch b/virtinst-fix-channel-parse.patch
new file mode 100644
index 0000000..b2227f0
--- /dev/null
+++ b/virtinst-fix-channel-parse.patch
@@ -0,0 +1,20 @@
+commit da4d42fd7c0c444874bd27488f4609f72bf9d1e7
+Author: Cole Robinson <crobinso at redhat.com>
+Date: Tue Apr 5 11:20:53 2011 -0400
+
+ Guest: Don't parse spice <channel> XML as a <channel> device
+
+diff --git a/virtinst/Guest.py b/virtinst/Guest.py
+index 4c0ef0b..02937b8 100644
+--- a/virtinst/Guest.py
++++ b/virtinst/Guest.py
+@@ -790,7 +790,8 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
+ if node.name != "devices":
+ continue
+
+- children = filter(lambda x: x.name in device_mappings,
++ children = filter(lambda x: (x.name in device_mappings and
++ x.parent == node),
+ node.children)
+ for devnode in children:
+ objclass = device_mappings.get(devnode.name)
diff --git a/virtinst-spicevmc-fixes.patch b/virtinst-spicevmc-fixes.patch
new file mode 100644
index 0000000..5d67db2
--- /dev/null
+++ b/virtinst-spicevmc-fixes.patch
@@ -0,0 +1,126 @@
+commit 26fe51966c955956ad1268fd38e55ba88dbb5d1f
+Author: Cole Robinson <crobinso at redhat.com>
+Date: Tue Apr 5 12:39:29 2011 -0400
+
+ virt-install: Parse chrdev target_type before other target params
+
+ Since their availability may depend on what target_type is being used (for
+ example, name= only applies to virtio target type, not guestfwd)
+
+diff --git a/virt-install b/virt-install
+index ce0a1fc..6aa0fff 100755
+--- a/virt-install
++++ b/virt-install
+@@ -187,7 +187,7 @@ def parse_char_option(guest, dev_type, optstring):
+ return
+
+ if not dev.supports_property(paramname):
+- raise ValueError(_("%(chartype)s type %(devtype)s does not "
++ raise ValueError(_("%(devtype)s type '%(chartype)s' does not "
+ "support '%(optname)s' option.") %
+ {"devtype" : dev_type, "chartype": char_type,
+ "optname" : dictname} )
+@@ -211,8 +211,8 @@ def parse_char_option(guest, dev_type, optstring):
+ set_param("source_port", "host", port)
+ set_param("bind_host", "bind_host", bind_host)
+ set_param("bind_port", "bind_host", bind_port)
+- set_param("target_name", "name")
+ set_param("target_type", "target_type")
++ set_param("target_name", "name")
+ set_param("target_address", "target_address", target_addr)
+ set_param("target_port", "target_address", target_port)
+
+commit 097db0ca7e25a2213a0dc69e788d40af8eb53945
+Author: Marc-André Lureau <marcandre.lureau at redhat.com>
+Date: Tue Apr 5 01:34:13 2011 +0200
+
+ virtinst: support to constrain the spicevmc usage to correct parameters
+
+ This patch is related to another proposed patch series for
+ virt-manager to allow adding and removing Spice channels easily.
+
+ crobinso: Made sure it didn't break test suite
+
+diff --git a/virtinst/VirtualCharDevice.py b/virtinst/VirtualCharDevice.py
+index f29081b..616a1e8 100644
+--- a/virtinst/VirtualCharDevice.py
++++ b/virtinst/VirtualCharDevice.py
+@@ -50,6 +50,16 @@ class VirtualCharDevice(VirtualDevice.VirtualDevice):
+ CHAR_PIPE, CHAR_NULL, CHAR_TCP, CHAR_UDP, CHAR_UNIX,
+ CHAR_SPICEVMC ]
+
++ _non_channel_types = char_types[:]
++ _non_channel_types.remove(CHAR_SPICEVMC)
++
++ char_types_for_dev_type = {
++ DEV_SERIAL: _non_channel_types,
++ DEV_PARALLEL: _non_channel_types,
++ DEV_CONSOLE: _non_channel_types,
++ DEV_CHANNEL: [ CHAR_SPICEVMC ],
++ }
++
+ CHAR_MODE_CONNECT = "connect"
+ CHAR_MODE_BIND = "bind"
+ char_modes = [ CHAR_MODE_CONNECT, CHAR_MODE_BIND ]
+@@ -71,6 +81,8 @@ class VirtualCharDevice(VirtualDevice.VirtualDevice):
+ CHAR_CONSOLE_TARGET_XEN = "xen"
+ CHAR_CONSOLE_TARGET_VIRTIO = "virtio"
+
++ has_target = False
++
+ def get_char_type_desc(char_type):
+ """
+ Return a human readable description of the passed char type
+@@ -213,11 +225,22 @@ class VirtualCharDevice(VirtualDevice.VirtualDevice):
+ "bind_port" : [self.CHAR_UDP],
+ }
+
++ channel_users = {
++ "target_name" : [self.CHAR_CHANNEL_TARGET_VIRTIO],
++ }
++
+ if users.get(propname):
+ return self.char_type in users[propname]
++ if channel_users.get(propname):
++ return (self.dev_type == self.DEV_CHANNEL and
++ self.target_type in channel_users[propname])
+ return hasattr(self, propname)
+
+ # Properties
++ def get_dev_type(self):
++ return self._dev_type
++ dev_type = property(get_dev_type)
++
+ def get_char_type(self):
+ return self._char_type
+ def set_char_type(self, val):
+@@ -330,7 +353,7 @@ class VirtualCharDevice(VirtualDevice.VirtualDevice):
+ def get_target_name(self):
+ return self._target_name
+ target_name = _xml_property(get_target_name, set_target_name,
+- doc=_("Sysfs Name of virtio port in the guest"),
++ doc=_("Sysfs name of virtio port in the guest"),
+ xpath="./target/@name")
+
+ def get_address_type(self):
+@@ -411,7 +434,8 @@ class VirtualCharDevice(VirtualDevice.VirtualDevice):
+ char_xml = self._char_xml()
+ target_xml = self._get_target_xml()
+ has_target = (self._dev_type == self.DEV_CHANNEL or
+- self._dev_type == self.DEV_CONSOLE)
++ self._dev_type == self.DEV_CONSOLE or
++ self.has_target)
+
+ if target_xml and not has_target:
+ raise RuntimeError(
+@@ -575,8 +599,9 @@ class VirtualCharSpicevmcDevice(VirtualCharDevice):
+ _char_type = VirtualCharDevice.CHAR_SPICEVMC
+ _char_xml = VirtualCharDevice._char_empty_xml
+ target_types = [ VirtualCharDevice.CHAR_CHANNEL_TARGET_VIRTIO ]
++ has_target = True
+
+- def __init__(self, conn, dev_type,
++ def __init__(self, conn, dev_type=VirtualCharDevice.DEV_CHANNEL,
+ parsexml=None, parsexmlnode=None, caps=None):
+ VirtualCharDevice.__init__(self, conn, dev_type,
+ parsexml, parsexmlnode, caps)
More information about the scm-commits
mailing list