render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c8c376
From d3d5bc437539aeaf88783636bfc24be554d2aa6a Mon Sep 17 00:00:00 2001
c8c376
Message-Id: <d3d5bc437539aeaf88783636bfc24be554d2aa6a@dist-git>
c8c376
From: Michal Privoznik <mprivozn@redhat.com>
c8c376
Date: Tue, 8 Nov 2016 13:42:06 +0100
c8c376
Subject: [PATCH] qemuDomainAttachNetDevice: Move hostdev handling a bit
c8c376
 further
c8c376
c8c376
RHEL-7.3: https://bugzilla.redhat.com/show_bug.cgi?id=1366108
c8c376
RHEL-7.3.z: https://bugzilla.redhat.com/show_bug.cgi?id=1392032
c8c376
c8c376
The idea is to have function that does some checking at its
c8c376
beginning and then have one big switch for all the interface
c8c376
types it supports.
c8c376
c8c376
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c8c376
(cherry picked from commit 5b65d772dd909d9b1ded07a86304229674ebf4ac)
c8c376
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c8c376
---
c8c376
 src/qemu/qemu_hotplug.c | 26 ++++++++++++--------------
c8c376
 1 file changed, 12 insertions(+), 14 deletions(-)
c8c376
c8c376
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
c8c376
index 4a3e97b58..ca2d89702 100644
c8c376
--- a/src/qemu/qemu_hotplug.c
c8c376
+++ b/src/qemu/qemu_hotplug.c
c8c376
@@ -916,20 +916,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
 
c8c376
     actualType = virDomainNetGetActualType(net);
c8c376
 
c8c376
-    if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
c8c376
-        /* This is really a "smart hostdev", so it should be attached
c8c376
-         * as a hostdev (the hostdev code will reach over into the
c8c376
-         * netdev-specific code as appropriate), then also added to
c8c376
-         * the nets list (see cleanup:) if successful.
c8c376
-         *
c8c376
-         * qemuDomainAttachHostDevice uses a connection to resolve
c8c376
-         * a SCSI hostdev secret, which is not this case, so pass NULL.
c8c376
-         */
c8c376
-        ret = qemuDomainAttachHostDevice(NULL, driver, vm,
c8c376
-                                         virDomainNetGetActualHostdev(net));
c8c376
-        goto cleanup;
c8c376
-    }
c8c376
-
c8c376
     /* Currently only TAP/macvtap devices supports multiqueue. */
c8c376
     if (net->driver.virtio.queues > 0 &&
c8c376
         !(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
c8c376
@@ -1007,6 +993,18 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
         if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps,
c8c376
                                       vhostfd, &vhostfdSize) < 0)
c8c376
             goto cleanup;
c8c376
+    } else if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
c8c376
+        /* This is really a "smart hostdev", so it should be attached
c8c376
+         * as a hostdev (the hostdev code will reach over into the
c8c376
+         * netdev-specific code as appropriate), then also added to
c8c376
+         * the nets list (see cleanup:) if successful.
c8c376
+         *
c8c376
+         * qemuDomainAttachHostDevice uses a connection to resolve
c8c376
+         * a SCSI hostdev secret, which is not this case, so pass NULL.
c8c376
+         */
c8c376
+        ret = qemuDomainAttachHostDevice(NULL, driver, vm,
c8c376
+                                         virDomainNetGetActualHostdev(net));
c8c376
+        goto cleanup;
c8c376
     }
c8c376
 
c8c376
     /* Set device online immediately */
c8c376
-- 
c8c376
2.11.0
c8c376