From nobody Sun May 5 07:19:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568386362; cv=none; d=zoho.com; s=zohoarc; b=D3lJpbGzobGSMDVdGToE77dmdJQm5d217vR41Son4kS0xA4DdXboV0y57sg10Z1ilKJ+5+SXP3FaDDVArGioRzimyCLtszAJJGUMpA+xfXdZBZ7onhNkPOkkVVeUiwaC8/BE79lOtGbxEibbw1wKkO2j71Xgufz6In/+dCqxgGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568386362; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ukb1bAr5X06rYlNFzlXuwUgfcFuXRspSe9LMB9tzC6Q=; b=CB6HeRdTWJUnkCRFJLZKGe9td47wUJDi7sarB259rQiw66iYv3VTWkRVGglYfVvKhWVBd71gRQebc7uFJY+J8v1aqx28ox6DZtXQohXsOQ55tgUM8/melSqQ1W5KGQl+dBKrBNCVNhSjvLgIoqrpYs43mVH2kksoH3Di6WxKsxk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568386362841341.83147285037774; Fri, 13 Sep 2019 07:52:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27963C04510D; Fri, 13 Sep 2019 14:52:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 029355D717; Fri, 13 Sep 2019 14:52:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B1BBA180B536; Fri, 13 Sep 2019 14:52:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8DEqdV1003074 for ; Fri, 13 Sep 2019 10:52:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 116A45DA5B; Fri, 13 Sep 2019 14:52:39 +0000 (UTC) Received: from vhost2.laine.org (ovpn-118-98.phx2.redhat.com [10.3.118.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id C436E5D9CD for ; Fri, 13 Sep 2019 14:52:38 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Fri, 13 Sep 2019 10:52:29 -0400 Message-Id: <20190913145231.774-2-laine@redhat.com> In-Reply-To: <20190913145231.774-1-laine@redhat.com> References: <20190913145231.774-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] conf: make arg to virDomainNetGetActualVirtPortProfile() a const X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 13 Sep 2019 14:52:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" It needs to be used by a function that only has a const pointer to virDomainNetDef. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik but please see my --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 96e9223e21..848c831330 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29678,7 +29678,7 @@ virDomainNetGetActualHostdev(virDomainNetDefPtr ifa= ce) } =20 virNetDevVPortProfilePtr -virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface) +virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface) { switch (iface->type) { case VIR_DOMAIN_NET_TYPE_DIRECT: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 82631ecb07..b688ee2b83 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3181,7 +3181,7 @@ const char *virDomainNetGetActualDirectDev(virDomainN= etDefPtr iface); int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface); virDomainHostdevDefPtr virDomainNetGetActualHostdev(virDomainNetDefPtr ifa= ce); virNetDevVPortProfilePtr -virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface); +virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface); virNetDevBandwidthPtr virDomainNetGetActualBandwidth(virDomainNetDefPtr iface); virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 07:19:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568386367; cv=none; d=zoho.com; s=zohoarc; b=gw9nouPkXFwe1a2hZ4cjEJVbJfpfaVoELUqSDGpWJwtp7K6pnHIcUoVFstUN7qpyoKTrDLjozUCty3s4rb2PlWIViY8HfjszSCMPnZp0kC/p+ntN7e3MJVZrC0elTWRxzu/I0BDizDnZyvUOht0gO/wgv1rOvvroqiptIsF4ol0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568386367; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1YtP/RaJV4IE+7/a1Xszn7mR8u3y0FPAKPqHn4zbuTc=; b=WGh2FTrMmA1ti7ynZxqgh8TOoNIztO7CeiIQaZXY50TUkEF/PKL4NTcgcPSyPQxmPYrDP3CjX0sSOdrqfyMA576XNc77Gc7ZnbtAwJxpUfevTIdX65bFX2AIdP8wqMwj2K8P7y2z9n1t0ixOyG5pimy+ZHcUxX2hAaacDUBpJiU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568386367578992.5210685907149; Fri, 13 Sep 2019 07:52:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC9043086218; Fri, 13 Sep 2019 14:52:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A66454502; Fri, 13 Sep 2019 14:52:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6529A24F33; Fri, 13 Sep 2019 14:52:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8DEqdoT003082 for ; Fri, 13 Sep 2019 10:52:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 782E65D9E1; Fri, 13 Sep 2019 14:52:39 +0000 (UTC) Received: from vhost2.laine.org (ovpn-118-98.phx2.redhat.com [10.3.118.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3872A5D9E5 for ; Fri, 13 Sep 2019 14:52:39 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Fri, 13 Sep 2019 10:52:30 -0400 Message-Id: <20190913145231.774-3-laine@redhat.com> In-Reply-To: <20190913145231.774-1-laine@redhat.com> References: <20190913145231.774-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] qemu: move runtime netdev validation into a separate function X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 13 Sep 2019 14:52:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The same validation should be done for both static network devices and hotplugged devices, but they are currently inconsistent. Move all the relevant validation from qemuBuildInterfaceCommandLine() into the new function qemuDomainValidateActualNetDef() and call the latter from the former. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik but please see my --- src/qemu/qemu_command.c | 52 +-------------------------- src/qemu/qemu_domain.c | 80 +++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 4 +++ 3 files changed, 85 insertions(+), 51 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f795f2e987..2acae3bf33 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8352,50 +8352,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr drive= r, if (!bootindex) bootindex =3D net->info.bootIndex; =20 - /* Currently nothing besides TAP devices supports multiqueue. */ - if (net->driver.virtio.queues > 0 && - !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_DIRECT || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_VHOSTUSER)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Multiqueue network is not supported for: %s"), - virDomainNetTypeToString(actualType)); + if (qemuDomainValidateActualNetDef(net, qemuCaps) < 0) return -1; - } - - /* and only TAP devices support nwfilter rules */ - if (net->filter) { - virNetDevVPortProfilePtr vport =3D virDomainNetGetActualVirtPortPr= ofile(net); - if (!(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("filterref is not supported for " - "network interfaces of type %s"), - virDomainNetTypeToString(actualType)); - return -1; - } - if (vport && vport->virtPortType !=3D VIR_NETDEV_VPORT_PROFILE_NON= E) { - /* currently none of the defined virtualport types support ipt= ables */ - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("filterref is not supported for " - "network interfaces with virtualport type %s"= ), - virNetDevVPortTypeToString(vport->virtPortType)= ); - return -1; - } - } - - if (net->backend.tap && - !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Custom tap device path is not supported for: %s"= ), - virDomainNetTypeToString(actualType)); - return -1; - } =20 switch (actualType) { case VIR_DOMAIN_NET_TYPE_NETWORK: @@ -8458,14 +8416,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr drive= r, case VIR_DOMAIN_NET_TYPE_VHOSTUSER: requireNicdev =3D true; =20 - if (net->driver.virtio.queues > 1 && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("multi-queue is not supported for vhost-user " - "with this QEMU binary")); - goto cleanup; - } - if (qemuInterfaceVhostuserConnect(driver, logManager, secManager, cmd, def, net, qemuCaps, &charde= v) < 0) goto cleanup; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bd247628cb..ebbe1a85db 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5300,6 +5300,86 @@ qemuDomainWatchdogDefValidate(const virDomainWatchdo= gDef *dev, } =20 =20 + +int +qemuDomainValidateActualNetDef(const virDomainNetDef *net, + virQEMUCapsPtr qemuCaps) +{ + /* + * Validations that can only be properly checked at runtime (after + * an has been resolved to its actual + * type. + * + * (In its current form this function can still be called before + * the actual type has been resolved (e.g. at domain definition + * time), but only if the validations would SUCCEED for + * type=3D'network'.) + */ + virDomainNetType actualType =3D virDomainNetGetActualType(net); + + /* Only tap/macvtap devices support multiqueue. */ + if (net->driver.virtio.queues > 1) { + + if (!(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_DIRECT || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_VHOSTUSER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("multiqueue network is not supported for: %s"= ), + virDomainNetTypeToString(actualType)); + return -1; + } + + if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_VHOSTUSER && + qemuCaps && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULT= IQUEUE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("multiqueue network is not supported for vhos= t-user " + "with this QEMU binary")); + return -1; + } + } + + /* + * Only standard tap devices support nwfilter rules, and even then only + * when *not* connected to an OVS bridge or midonet (indicated by havi= ng + * a element in the config) + */ + if (net->filter) { + virNetDevVPortProfilePtr vport =3D virDomainNetGetActualVirtPortPr= ofile(net); + if (!(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("filterref is not supported for " + "network interfaces of type %s"), + virDomainNetTypeToString(actualType)); + return -1; + } + if (vport && vport->virtPortType !=3D VIR_NETDEV_VPORT_PROFILE_NON= E) { + /* currently none of the defined virtualport types support ipt= ables */ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("filterref is not supported for " + "network interfaces with virtualport type %s"= ), + virNetDevVPortTypeToString(vport->virtPortType)= ); + return -1; + } + } + + if (net->backend.tap && + !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Custom tap device path is not supported for: %s"= ), + virDomainNetTypeToString(actualType)); + return -1; + } + + return 0; + } + + static int qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 3e87e75c3a..f53ea146e1 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1215,3 +1215,7 @@ qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cf= g, =20 virDomainEventSuspendedDetailType qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason); + +int +qemuDomainValidateActualNetDef(const virDomainNetDef *net, + virQEMUCapsPtr qemuCaps); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 07:19:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568386368; cv=none; d=zoho.com; s=zohoarc; b=Kh9FulH+mRHpFDkehhiGkMUo4drnXlfX2qEQ0woP14p47/l6yBNU/LdP9CnrRvb2tvmu74XeiROYcRqLIzDv0H52MKfTITsRDDbC3zozPg0Q1hVsStwYKhNU3FfPC39PO081oetHkTU+mavoeWfcbqcMM/Wc3R32ZZ31cm4JHx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568386368; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wBFVYBIFqt1gDq5YbjXTzv2m8xi9bePugwC44lCbSjg=; b=F57hD1ECKqKBi6j3nei2SdjjaCS/KVhAZxWnP6WvO43DirCkmjFRhOjrqzfpm/QeyGT2NtXQHgwoqk3A4Ujf3OnO2H+PCmW4J8EWGElfqKRxpyCxyX7SHseVn9OwWcNe4MYR+XTZhXDqrYPnUglAZiSKmcgL5ZaEc4UhuPjcS30= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568386368090945.8785181045855; Fri, 13 Sep 2019 07:52:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6EEC8980FB; Fri, 13 Sep 2019 14:52:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A17BA518EA; Fri, 13 Sep 2019 14:52:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5E3C9180B536; Fri, 13 Sep 2019 14:52:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8DEqdJt003087 for ; Fri, 13 Sep 2019 10:52:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id E26BD5D9CD; Fri, 13 Sep 2019 14:52:39 +0000 (UTC) Received: from vhost2.laine.org (ovpn-118-98.phx2.redhat.com [10.3.118.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id A246B5D9E1 for ; Fri, 13 Sep 2019 14:52:39 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Fri, 13 Sep 2019 10:52:31 -0400 Message-Id: <20190913145231.774-4-laine@redhat.com> In-Reply-To: <20190913145231.774-1-laine@redhat.com> References: <20190913145231.774-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] qemu: call common NetDef validation for hotplug and device update X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Fri, 13 Sep 2019 14:52:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 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 but please see my --- 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 bd8868b0f7..0530bdd990 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1188,32 +1188,11 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, goto cleanup; } =20 - actualType =3D virDomainNetGetActualType(net); - - /* Currently only TAP/macvtap devices supports multiqueue. */ - if (net->driver.virtio.queues > 0 && - !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_DIRECT || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET || - actualType =3D=3D 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; - } =20 - /* and only TAP devices support nwfilter rules */ - if (net->filter && - !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || - actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || - actualType =3D=3D 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 =3D virDomainNetGetActualType(net); =20 if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0) goto cleanup; @@ -3542,6 +3521,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainDeviceDefPtr dev) { + qemuDomainObjPrivatePtr priv =3D vm->privateData; virDomainNetDefPtr newdev =3D dev->data.net; virDomainNetDefPtr *devslot =3D NULL; virDomainNetDefPtr olddev; @@ -3749,6 +3729,10 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, goto cleanup; } =20 + /* final validation now that we have full info on the type */ + if (qemuDomainValidateActualNetDef(newdev, priv->qemuCaps) < 0) + goto cleanup; + newType =3D virDomainNetGetActualType(newdev); =20 if (newType =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list