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