[libvirt] Fix connecting to qemu:///session (bz #1198244)

Cole Robinson crobinso at fedoraproject.org
Tue Mar 10 15:10:19 UTC 2015


commit 6b531d9967048eb0150402ae8aeb70894867cb0c
Author: Cole Robinson <crobinso at redhat.com>
Date:   Tue Mar 10 11:10:16 2015 -0400

    Fix connecting to qemu:///session (bz #1198244)

 ...fill-in-nicindexes-for-session-mode-libvi.patch | 46 ++++++++++++++++++++++
 libvirt.spec                                       |  8 +++-
 2 files changed, 53 insertions(+), 1 deletion(-)
---
diff --git a/0001-qemu-don-t-fill-in-nicindexes-for-session-mode-libvi.patch b/0001-qemu-don-t-fill-in-nicindexes-for-session-mode-libvi.patch
new file mode 100644
index 0000000..6843ad4
--- /dev/null
+++ b/0001-qemu-don-t-fill-in-nicindexes-for-session-mode-libvi.patch
@@ -0,0 +1,46 @@
+From: Laine Stump <laine at laine.org>
+Date: Tue, 10 Mar 2015 02:09:24 -0400
+Subject: [PATCH] qemu: don't fill in nicindexes for session mode libvirtd
+
+Commit 4bbe1029f fixed a problem in commit f7afeddc by moving the call
+to virNetDevGetIndex() to a location common to all interface types (so
+that the nicindex array would be filled in for macvtap as well as tap
+interfaces), but the location was *too* common, as the original call
+to virNetDevGetIndex() had been in a section qualified by "if
+(cfg->privileged)". The result was that the "fixed" libvirtd would try
+to call virNetDevGetIndex() even for session mode libvirtd, and end up
+failing with the log message:
+
+  Unable to open control socket: Operation not permitted
+
+To remedy that, this patch qualifies the call to virNetDevGetIndex()
+in its new location with cfg->privileged.
+
+This resolves https://bugzilla.redhat.com/show_bug.cgi?id=1198244
+
+(cherry picked from commit 705242f8809dc2222c35c64d5408dd6b0cc94cf8)
+---
+ src/qemu/qemu_command.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
+index 24b2ad9..6526ba8 100644
+--- a/src/qemu/qemu_command.c
++++ b/src/qemu/qemu_command.c
+@@ -7766,6 +7766,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
+     char **tapfdName = NULL;
+     char **vhostfdName = NULL;
+     int actualType = virDomainNetGetActualType(net);
++    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+     virNetDevBandwidthPtr actualBandwidth;
+     size_t i;
+ 
+@@ -7841,7 +7842,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
+         /* network and bridge use a tap device, and direct uses a
+          * macvtap device
+          */
+-        if (nicindexes && nnicindexes && net->ifname) {
++        if (cfg->privileged && nicindexes && nnicindexes && net->ifname) {
+             if (virNetDevGetIndex(net->ifname, &nicindex) < 0 ||
+                 VIR_APPEND_ELEMENT(*nicindexes, *nnicindexes, nicindex) < 0)
+                 goto cleanup;
diff --git a/libvirt.spec b/libvirt.spec
index fbad054..a62962f 100644
--- a/libvirt.spec
+++ b/libvirt.spec
@@ -365,7 +365,7 @@
 Summary: Library providing a simple virtualization API
 Name: libvirt
 Version: 1.2.13
-Release: 1%{?dist}%{?extra_release}
+Release: 2%{?dist}%{?extra_release}
 License: LGPLv2+
 Group: Development/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -376,6 +376,9 @@ URL: http://libvirt.org/
 %endif
 Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz
 
+# Fix connecting to qemu:///session (bz #1198244)
+Patch0001: 0001-qemu-don-t-fill-in-nicindexes-for-session-mode-libvi.patch
+
 %if %{with_libvirtd}
 Requires: libvirt-daemon = %{version}-%{release}
     %if %{with_network}
@@ -2279,6 +2282,9 @@ exit 0
 %doc examples/systemtap
 
 %changelog
+* Tue Mar 10 2015 Cole Robinson <crobinso at redhat.com> - 1.2.13-2
+- Fix connecting to qemu:///session (bz #1198244)
+
 * Mon Mar 02 2015 Cole Robinson <crobinso at redhat.com> - 1.2.13-1
 - Rebased to version 1.2.13
 - lot of improvements around NUMA code


More information about the scm-commits mailing list