|
|
d759b5 |
From 1b3ded7e3b24f927a7941178e2bb75d1d8052c3f Mon Sep 17 00:00:00 2001
|
|
|
d759b5 |
Message-Id: <1b3ded7e3b24f927a7941178e2bb75d1d8052c3f@dist-git>
|
|
|
d759b5 |
From: Laine Stump <laine@redhat.com>
|
|
|
d759b5 |
Date: Mon, 16 Sep 2019 09:54:06 -0400
|
|
|
d759b5 |
Subject: [PATCH] qemu: call common NetDef validation for hotplug and device
|
|
|
d759b5 |
update
|
|
|
d759b5 |
MIME-Version: 1.0
|
|
|
d759b5 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d759b5 |
Content-Transfer-Encoding: 8bit
|
|
|
d759b5 |
|
|
|
d759b5 |
qemuDomainAttachNetDevice() (hotplug) previously had some of the
|
|
|
d759b5 |
validation that is in qemuDomainValidateActualNetDef(), but it was
|
|
|
d759b5 |
incomplete. qemuDomainChangeNet() had none of that validation, but it
|
|
|
d759b5 |
is all appropriate in both cases.
|
|
|
d759b5 |
|
|
|
d759b5 |
This is the final piece of a previously partial resolution to
|
|
|
d759b5 |
https://bugzilla.redhat.com/1502754
|
|
|
d759b5 |
|
|
|
d759b5 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
d759b5 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
d759b5 |
(cherry picked from commit 70a29b378a397f6f4571c95b9d3cbba711a90859)
|
|
|
d759b5 |
|
|
|
d759b5 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
d759b5 |
Message-Id: <20190916135406.18523-4-laine@redhat.com>
|
|
|
d759b5 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d759b5 |
---
|
|
|
d759b5 |
src/qemu/qemu_hotplug.c | 32 ++++++++------------------------
|
|
|
d759b5 |
1 file changed, 8 insertions(+), 24 deletions(-)
|
|
|
d759b5 |
|
|
|
d759b5 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
d759b5 |
index ca8b0aaf62..3b888e31b9 100644
|
|
|
d759b5 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
d759b5 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
d759b5 |
@@ -848,32 +848,11 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|
|
d759b5 |
if (virDomainNetAllocateActualDevice(vm->def, net) < 0)
|
|
|
d759b5 |
goto cleanup;
|
|
|
d759b5 |
|
|
|
d759b5 |
- actualType = virDomainNetGetActualType(net);
|
|
|
d759b5 |
-
|
|
|
d759b5 |
- /* Currently only TAP/macvtap devices supports multiqueue. */
|
|
|
d759b5 |
- if (net->driver.virtio.queues > 0 &&
|
|
|
d759b5 |
- !(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
|
|
d759b5 |
- actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
|
|
d759b5 |
- actualType == VIR_DOMAIN_NET_TYPE_DIRECT ||
|
|
|
d759b5 |
- actualType == VIR_DOMAIN_NET_TYPE_ETHERNET ||
|
|
|
d759b5 |
- actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER)) {
|
|
|
d759b5 |
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
d759b5 |
- _("Multiqueue network is not supported for: %s"),
|
|
|
d759b5 |
- virDomainNetTypeToString(actualType));
|
|
|
d759b5 |
+ /* final validation now that we have full info on the type */
|
|
|
d759b5 |
+ if (qemuDomainValidateActualNetDef(net, priv->qemuCaps) < 0)
|
|
|
d759b5 |
return -1;
|
|
|
d759b5 |
- }
|
|
|
d759b5 |
|
|
|
d759b5 |
- /* and only TAP devices support nwfilter rules */
|
|
|
d759b5 |
- if (net->filter &&
|
|
|
d759b5 |
- !(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
|
|
d759b5 |
- actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
|
|
d759b5 |
- actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)) {
|
|
|
d759b5 |
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
d759b5 |
- _("filterref is not supported for "
|
|
|
d759b5 |
- "network interfaces of type %s"),
|
|
|
d759b5 |
- virDomainNetTypeToString(actualType));
|
|
|
d759b5 |
- return -1;
|
|
|
d759b5 |
- }
|
|
|
d759b5 |
+ actualType = virDomainNetGetActualType(net);
|
|
|
d759b5 |
|
|
|
d759b5 |
if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0)
|
|
|
d759b5 |
goto cleanup;
|
|
|
d759b5 |
@@ -3154,6 +3133,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
|
|
d759b5 |
virDomainObjPtr vm,
|
|
|
d759b5 |
virDomainDeviceDefPtr dev)
|
|
|
d759b5 |
{
|
|
|
d759b5 |
+ qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
d759b5 |
virDomainNetDefPtr newdev = dev->data.net;
|
|
|
d759b5 |
virDomainNetDefPtr *devslot = NULL;
|
|
|
d759b5 |
virDomainNetDefPtr olddev;
|
|
|
d759b5 |
@@ -3333,6 +3313,10 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
|
|
d759b5 |
goto cleanup;
|
|
|
d759b5 |
}
|
|
|
d759b5 |
|
|
|
d759b5 |
+ /* final validation now that we have full info on the type */
|
|
|
d759b5 |
+ if (qemuDomainValidateActualNetDef(newdev, priv->qemuCaps) < 0)
|
|
|
d759b5 |
+ goto cleanup;
|
|
|
d759b5 |
+
|
|
|
d759b5 |
newType = virDomainNetGetActualType(newdev);
|
|
|
d759b5 |
|
|
|
d759b5 |
if (newType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
|
|
d759b5 |
--
|
|
|
d759b5 |
2.23.0
|
|
|
d759b5 |
|