From nobody Mon Apr 29 04:26:59 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1513193116895545.7559678798091; Wed, 13 Dec 2017 11:25:16 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF09691FC8; Wed, 13 Dec 2017 19:25:15 +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 830BE784DD; Wed, 13 Dec 2017 19:25:15 +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 45F7B180474A; Wed, 13 Dec 2017 19:25:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBDJOAGd025554 for ; Wed, 13 Dec 2017 14:24:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id A288C7BFF6; Wed, 13 Dec 2017 19:24:10 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-202.phx2.redhat.com [10.3.117.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C0127BFFF; Wed, 13 Dec 2017 19:24:10 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 13 Dec 2017 14:24:02 -0500 Message-Id: <20171213192403.19967-2-laine@laine.org> In-Reply-To: <20171213192403.19967-1-laine@laine.org> References: <20171213192403.19967-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Michal Privoznik Subject: [libvirt] [PATCH 1/2] qemu: delete exist bandwidth restrictions when they are removed from config 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 13 Dec 2017 19:25:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When the of an interface is changed with update-device, the old settings are cleared with tc, then new settings added with tc. But if the ifname, - virDomainNetGetActualBandwidth(newdev), - false, - !virDomainNetTypeSharesHostView(newdev))= < 0) - goto cleanup; + virNetDevBandwidthPtr newb =3D virDomainNetGetActualBandwidth(newd= ev); + + if (newb) { + if (virNetDevBandwidthSet(newdev->ifname, newb, false, + !virDomainNetTypeSharesHostView(newd= ev)) < 0) + goto cleanup; + } else { + /* + * virNetDevBandwidthSet() doesn't clear any existing + * setting unless something new is being set. + */ + virNetDevBandwidthClear(newdev->ifname); + } needReplaceDevDef =3D true; } =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 04:26:59 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1513193191422318.44658674795403; Wed, 13 Dec 2017 11:26:31 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C51479706; Wed, 13 Dec 2017 19:26:30 +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 E36257D92C; Wed, 13 Dec 2017 19:26:29 +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 967984BB79; Wed, 13 Dec 2017 19:26:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBDJOBcB025559 for ; Wed, 13 Dec 2017 14:24:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 18A987BFF6; Wed, 13 Dec 2017 19:24:11 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-202.phx2.redhat.com [10.3.117.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD2AD7BA39 for ; Wed, 13 Dec 2017 19:24:10 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 13 Dec 2017 14:24:03 -0500 Message-Id: <20171213192403.19967-3-laine@laine.org> In-Reply-To: <20171213192403.19967-1-laine@laine.org> References: <20171213192403.19967-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] qemu: log error on attempts to set filterref on an OVS-connected interface 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: , MIME-Version: 1.0 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Dec 2017 19:26:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ebtables/iptables processing is skipped for any interface connected to Open vSwitch (they have their own packet filtering), likewise for midonet (according to http://blog.midokura.com/2016/04/midonet-rule-chains), but libvirt would allow adding a to interfaces connected in these ways, so the user might mistakenly believe they were being protected. This patch checks for a non-NULL element for an interface (or its network) and logs an error if and are both present. This could cause some previously working domains to no longer start, but that's really the whole point of this patch - to warn people that their filterref isn't protecting them as they might have thought. I don't bother checking this during post-parse validation, because such a check would be incomplete - it's possible that a network would have a that would be applied to an interface, and you can't know that until the domain is started. Resolves: https://bugzilla.redhat.com/1502754 --- src/qemu/qemu_command.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2dd50a214..4d0c141e5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8545,15 +8545,25 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driv= er, } =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; + 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; + } } =20 if (net->backend.tap && --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list