Fix creating i686 guest with x86_64 emulator (bz #1153797)

Fix tests with latest libxml2
This commit is contained in:
Cole Robinson 2014-10-30 11:01:41 -04:00
parent 503330ba5d
commit 91063332d7
3 changed files with 116 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From cd1b72fdd821d1fb4d08198833ea782651760e01 Mon Sep 17 00:00:00 2001
Message-Id: <cd1b72fdd821d1fb4d08198833ea782651760e01.1414680021.git.crobinso@redhat.com>
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 16 Oct 2014 21:28:00 +0200
Subject: [PATCH 4/5] qemu: x86_64 is good enough for i686
virt-manager on Fedora sets up i686 hosts with "/usr/bin/qemu-kvm" emulator,
which in turn unconditionally execs qemu-system-x86_64 querying capabilities
then fails:
Error launching details: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/engine.py", line 748, in _show_vm_helper
details = self._get_details_dialog(uri, vm.get_connkey())
File "/usr/share/virt-manager/virtManager/engine.py", line 726, in _get_details_dialog
obj = vmmDetails(conn.get_vm(connkey))
File "/usr/share/virt-manager/virtManager/details.py", line 399, in __init__
self.init_details()
File "/usr/share/virt-manager/virtManager/details.py", line 784, in init_details
domcaps = self.vm.get_domain_capabilities()
File "/usr/share/virt-manager/virtManager/domain.py", line 518, in get_domain_capabilities
self.get_xmlobj().os.machine, self.get_xmlobj().type)
File "/usr/lib/python2.7/site-packages/libvirt.py", line 3492, in getDomainCapabilities
if ret is None: raise libvirtError ('virConnectGetDomainCapabilities() failed', conn=self)
libvirtError: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'
Journal:
Oct 16 21:08:26 goatlord.localdomain libvirtd[1530]: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'
(cherry picked from commit afe8f4200f6e80d2510731165dd2cdae741bd9fb)
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e873d45..d379c1f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17572,7 +17572,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
arch_from_caps = virQEMUCapsGetArch(qemuCaps);
- if (arch_from_caps != arch) {
+ if (arch_from_caps != arch &&
+ (arch_from_caps != VIR_ARCH_X86_64 || arch != VIR_ARCH_I686)) {
virReportError(VIR_ERR_INVALID_ARG,
_("architecture from emulator '%s' doesn't "
"match given architecture '%s'"),
--
2.1.0

View File

@ -0,0 +1,50 @@
From f4d5340ba116befaa965e14537f42c2ead17d486 Mon Sep 17 00:00:00 2001
Message-Id: <f4d5340ba116befaa965e14537f42c2ead17d486.1414680854.git.crobinso@redhat.com>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Fri, 3 Oct 2014 18:27:01 +0200
Subject: [PATCH] util: Prepare URI formatting for libxml2 >= 2.9.2
Since commit 8eb55d782a2b9afacc7938694891cc6fad7b42a5 libxml2 removes
two slashes from the URI when there is no server part. This is fixed
with beb7281055dbf0ed4d041022a67c6c5cfd126f25, but only if the calling
application calls xmlSaveUri() on URI that xmlURIParse() parsed. And
that is not the case in virURIFormat(). virURIFormat() accepts
virURIPtr that can be created without parsing it and we do that when we
format network storage paths for gluster for example. Even though
virStorageSourceParseBackingURI() uses virURIParse(), it throws that data
structure right away.
Since we want to format URIs as URIs and not absolute URIs or opaque
URIs (see RFC 3986), we can specify that with a special hack thanks to
commit beb7281055dbf0ed4d041022a67c6c5cfd126f25, by setting port to -1.
This fixes qemuxml2argvtest test where the disk-drive-network-gluster
case was failing.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 8f17d0eaae7ee2fa3e214b79b188fc14ed5aa1eb)
---
src/util/viruri.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 69e7649..23d86c5 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -254,6 +254,13 @@ virURIFormat(virURIPtr uri)
xmluri.server = tmpserver;
}
+ /*
+ * This helps libxml2 deal with the difference
+ * between uri:/absolute/path and uri:///absolute/path.
+ */
+ if (!xmluri.server && !xmluri.port)
+ xmluri.port = -1;
+
ret = (char *)xmlSaveUri(&xmluri);
if (!ret) {
virReportOOMError();
--
2.1.0

View File

@ -363,7 +363,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 1.2.9
Release: 3%{?dist}%{?extra_release}
Release: 4%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@ -379,6 +379,10 @@ Patch0001: 0001-qemu_command-Split-qemuBuildCpuArgStr.patch
Patch0002: 0002-qemu-Don-t-compare-CPU-against-host-for-TCG.patch
# Fix selinux errors with /dev/net/tun (bz #1147057)
Patch0003: 0003-security_selinux-Don-t-relabel-dev-net-tun.patch
# Fix creating i686 guest with x86_64 emulator (bz #1153797)
Patch0004: 0004-qemu-x86_64-is-good-enough-for-i686.patch
# Fix tests with latest libxml2
Patch0005: 0005-util-Prepare-URI-formatting-for-libxml2-2.9.2.patch
%if %{with_libvirtd}
Requires: libvirt-daemon = %{version}-%{release}
@ -1209,6 +1213,10 @@ driver
%patch0002 -p1
# Fix selinux errors with /dev/net/tun (bz #1147057)
%patch0003 -p1
# Fix creating i686 guest with x86_64 emulator (bz #1153797)
%patch0004 -p1
# Fix tests with latest libxml2
%patch0005 -p1
%build
%if ! %{with_xen}
@ -2286,6 +2294,10 @@ exit 0
%doc examples/systemtap
%changelog
* Thu Oct 30 2014 Cole Robinson <crobinso@redhat.com> - 1.2.9-4
- Fix creating i686 guest with x86_64 emulator (bz #1153797)
- Fix tests with latest libxml2
* Thu Oct 09 2014 Cole Robinson <crobinso@redhat.com> - 1.2.9-3
- Fix selinux errors with /dev/net/tun (bz #1147057)