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