]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: don't fill in nicindexes for session mode libvirtd
authorLaine Stump <laine@laine.org>
Tue, 10 Mar 2015 06:09:24 +0000 (02:09 -0400)
committerLaine Stump <laine@laine.org>
Tue, 10 Mar 2015 11:53:10 +0000 (07:53 -0400)
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

src/qemu/qemu_command.c

index 1510797def8c23c42e16718b651fadd3d05747ea..3d1483e0234b6dd3b99b4e2560020d0b1cebee89 100644 (file)
@@ -7861,6 +7861,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
     char **tapfdName = NULL;
     char **vhostfdName = NULL;
     int actualType = virDomainNetGetActualType(net);
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     virNetDevBandwidthPtr actualBandwidth;
     size_t i;
 
@@ -7936,7 +7937,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;