|
 |
6b531d |
From: Laine Stump <laine@laine.org>
|
|
 |
6b531d |
Date: Tue, 10 Mar 2015 02:09:24 -0400
|
|
 |
6b531d |
Subject: [PATCH] qemu: don't fill in nicindexes for session mode libvirtd
|
|
 |
6b531d |
|
|
 |
6b531d |
Commit 4bbe1029f fixed a problem in commit f7afeddc by moving the call
|
|
 |
6b531d |
to virNetDevGetIndex() to a location common to all interface types (so
|
|
 |
6b531d |
that the nicindex array would be filled in for macvtap as well as tap
|
|
 |
6b531d |
interfaces), but the location was *too* common, as the original call
|
|
 |
6b531d |
to virNetDevGetIndex() had been in a section qualified by "if
|
|
 |
6b531d |
(cfg->privileged)". The result was that the "fixed" libvirtd would try
|
|
 |
6b531d |
to call virNetDevGetIndex() even for session mode libvirtd, and end up
|
|
 |
6b531d |
failing with the log message:
|
|
 |
6b531d |
|
|
 |
6b531d |
Unable to open control socket: Operation not permitted
|
|
 |
6b531d |
|
|
 |
6b531d |
To remedy that, this patch qualifies the call to virNetDevGetIndex()
|
|
 |
6b531d |
in its new location with cfg->privileged.
|
|
 |
6b531d |
|
|
 |
6b531d |
This resolves https://bugzilla.redhat.com/show_bug.cgi?id=1198244
|
|
 |
6b531d |
|
|
 |
6b531d |
(cherry picked from commit 705242f8809dc2222c35c64d5408dd6b0cc94cf8)
|
|
 |
6b531d |
---
|
|
 |
6b531d |
src/qemu/qemu_command.c | 3 ++-
|
|
 |
6b531d |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
 |
6b531d |
|
|
 |
6b531d |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
 |
6b531d |
index 24b2ad9..6526ba8 100644
|
|
 |
6b531d |
--- a/src/qemu/qemu_command.c
|
|
 |
6b531d |
+++ b/src/qemu/qemu_command.c
|
|
 |
6b531d |
@@ -7766,6 +7766,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
|
 |
6b531d |
char **tapfdName = NULL;
|
|
 |
6b531d |
char **vhostfdName = NULL;
|
|
 |
6b531d |
int actualType = virDomainNetGetActualType(net);
|
|
 |
6b531d |
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
|
 |
6b531d |
virNetDevBandwidthPtr actualBandwidth;
|
|
 |
6b531d |
size_t i;
|
|
 |
6b531d |
|
|
 |
6b531d |
@@ -7841,7 +7842,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
|
 |
6b531d |
/* network and bridge use a tap device, and direct uses a
|
|
 |
6b531d |
* macvtap device
|
|
 |
6b531d |
*/
|
|
 |
6b531d |
- if (nicindexes && nnicindexes && net->ifname) {
|
|
 |
6b531d |
+ if (cfg->privileged && nicindexes && nnicindexes && net->ifname) {
|
|
 |
6b531d |
if (virNetDevGetIndex(net->ifname, &nicindex) < 0 ||
|
|
 |
6b531d |
VIR_APPEND_ELEMENT(*nicindexes, *nnicindexes, nicindex) < 0)
|
|
 |
6b531d |
goto cleanup;
|