From nobody Thu Apr 25 21:46:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1581697614337293.6562540071196; Fri, 14 Feb 2020 08:26:54 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-215-Vnx6EM9DMmeHXNBDImPBhA-1; Fri, 14 Feb 2020 11:26:50 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B673B13E6; Fri, 14 Feb 2020 16:26:43 +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 886625C13E; Fri, 14 Feb 2020 16:26:43 +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 2DA0F8B2C8; Fri, 14 Feb 2020 16:26:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01EGQU8d028503 for ; Fri, 14 Feb 2020 11:26:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id B78241001B3F; Fri, 14 Feb 2020 16:26:30 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 048951001B28; Fri, 14 Feb 2020 16:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581697612; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0ecCAvAs8RN9b72q+4/aIgDwmaxt5re9ICZls2cJpoM=; b=Og3mJgGMCzxZ+1bL80eOcbbfC8iaendmE7B7wVq9M/YMRo5t70W0GgnL6LPPU/qniW6lVU LnA7mvhUmR2e5sF4fpdNSAtaZOV0mPaAgVunqttI9tDn0FArfK6hzgzdLE/+NCeYY5m5yN gm4qhV8+juD2YnyoULWXyJNAyXgje38= From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/6] qemu: test if bandwidth has 'floor' factored out to separate function Date: Fri, 14 Feb 2020 17:26:19 +0100 Message-Id: <20200214162624.147825-2-pmores@redhat.com> In-Reply-To: <20200214162624.147825-1-pmores@redhat.com> References: <20200214162624.147825-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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: , 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-MC-Unique: Vnx6EM9DMmeHXNBDImPBhA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This compound condition will be useful in several places so it makes sense to give it a name for better readability. Signed-off-by: Pavel Mores Reviewed-by: Michal Privoznik --- src/conf/netdev_bandwidth_conf.h | 7 +++++++ src/network/bridge_driver.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_c= onf.h index 0004e48a4a..5b5ed52566 100644 --- a/src/conf/netdev_bandwidth_conf.h +++ b/src/conf/netdev_bandwidth_conf.h @@ -23,6 +23,7 @@ #include "virbuffer.h" #include "virxml.h" #include "domain_conf.h" +#include "network_conf.h" =20 int virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth, unsigned int *class_id, @@ -57,3 +58,9 @@ static inline bool virNetDevSupportBandwidth(virDomainNet= Type type) } return false; } + + +static inline bool virNetDevBandwidthHasFloor(const virNetDevBandwidth *b) +{ + return b && b->in && b->in->floor !=3D 0; +} diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 94212eec77..14976c9821 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -5065,8 +5065,7 @@ networkCheckBandwidth(virNetworkObjPtr obj, =20 virMacAddrFormat(ifaceMac, ifmac); =20 - if (ifaceBand && ifaceBand->in && ifaceBand->in->floor && - !(netBand && netBand->in)) { + if (virNetDevBandwidthHasFloor(ifaceBand) && !(netBand && netBand->in)= ) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("Invalid use of 'floor' on interface with MAC " "address %s - network '%s' has no inbound QoS set= "), @@ -5079,8 +5078,9 @@ networkCheckBandwidth(virNetworkObjPtr obj, /* no QoS required, claim success */ return 1; } - if (((!ifaceBand || !ifaceBand->in || !ifaceBand->in->floor) && - (!oldBandwidth || !oldBandwidth->in || !oldBandwidth->in->floor))= ) { + if (!virNetDevBandwidthHasFloor(ifaceBand) && + !virNetDevBandwidthHasFloor(oldBandwidth)) { + VIR_DEBUG("No old/new interface bandwidth floor"); /* no QoS required, claim success */ return 1; --=20 2.24.1 From nobody Thu Apr 25 21:46:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1581697603987244.6466008753846; Fri, 14 Feb 2020 08:26:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-346-8n_0VkWyNf6XT5K-pe7KHA-1; Fri, 14 Feb 2020 11:26:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E68A8017CC; Fri, 14 Feb 2020 16:26:34 +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 826AD83865; Fri, 14 Feb 2020 16:26:33 +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 694EB18089CD; Fri, 14 Feb 2020 16:26:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01EGQVrC028513 for ; Fri, 14 Feb 2020 11:26:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id B846D1001B34; Fri, 14 Feb 2020 16:26:31 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 139CE1001B28; Fri, 14 Feb 2020 16:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581697602; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gVhJ0yyoGr5tvoRiBRUrlvl6B2wdQoac/k/oxWXqrp0=; b=iCUB5rTYgQZZWU6s42Seek/3XF72zzkG2j/HPA8IZ2Hf0goYCpDr3NC58D8s2AudUEah8I tHr5Km+EWREe5avHHVe1KBbsdjYNTe5JFEFAYXjkYljNNkd0uJ9nb88p+e0AOfb9vNsUqw L3OmYJKBhFuU8PAFuy7lJH2IyFXYJuY= From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/6] qemu: add function to test if network supports setting 'floor' Date: Fri, 14 Feb 2020 17:26:20 +0100 Message-Id: <20200214162624.147825-3-pmores@redhat.com> In-Reply-To: <20200214162624.147825-1-pmores@redhat.com> References: <20200214162624.147825-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 8n_0VkWyNf6XT5K-pe7KHA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function will be useful in upcoming commits when code to check whether a network can support 'floor' in the first place is introduced. Signed-off-by: Pavel Mores Reviewed-by: Michal Privoznik --- src/conf/netdev_bandwidth_conf.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_c= onf.h index 5b5ed52566..0596d555e5 100644 --- a/src/conf/netdev_bandwidth_conf.h +++ b/src/conf/netdev_bandwidth_conf.h @@ -60,6 +60,26 @@ static inline bool virNetDevSupportBandwidth(virDomainNe= tType type) } =20 =20 +static inline bool virNetDevSupportBandwidthFloor(virNetworkForwardType ty= pe) +{ + switch (type) { + case VIR_NETWORK_FORWARD_NONE: + case VIR_NETWORK_FORWARD_NAT: + case VIR_NETWORK_FORWARD_ROUTE: + case VIR_NETWORK_FORWARD_OPEN: + return true; + case VIR_NETWORK_FORWARD_BRIDGE: + case VIR_NETWORK_FORWARD_PRIVATE: + case VIR_NETWORK_FORWARD_VEPA: + case VIR_NETWORK_FORWARD_PASSTHROUGH: + case VIR_NETWORK_FORWARD_HOSTDEV: + case VIR_NETWORK_FORWARD_LAST: + break; + } + return false; +} + + static inline bool virNetDevBandwidthHasFloor(const virNetDevBandwidth *b) { return b && b->in && b->in->floor !=3D 0; --=20 2.24.1 From nobody Thu Apr 25 21:46:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1581697605379150.8645060526834; Fri, 14 Feb 2020 08:26:45 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-YfyOV-ImO5CWkjDS9WVDzQ-1; Fri, 14 Feb 2020 11:26:42 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 792A88010E3; Fri, 14 Feb 2020 16:26:36 +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 50CAE60BF1; Fri, 14 Feb 2020 16:26:36 +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 09C2A18089CF; Fri, 14 Feb 2020 16:26:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01EGQWig028524 for ; Fri, 14 Feb 2020 11:26:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA8141001B34; Fri, 14 Feb 2020 16:26:32 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1424C1001B28; Fri, 14 Feb 2020 16:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581697604; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4dPtO/Idw5QM/7pvy9I29OcrCOhS/wgOHBFJYJvn+mw=; b=KCRqJefX+ViG2JXuygijQcJUUz3RREWovjF4s8FVjZqsh25Wn+/qwanzn7QCAaSTZeGoER QRm+UAQkLRqS8U3L0k8vuHOKgcScYfkdXlxSMpbjnk1/CZQ42wCpygWWuoSMXnER121PNY Sa9KhlTM70uL9TlT3FLBrOJUZyX5iPU= From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/6] qemu: fail on attempt to set 'floor' if interface type is not 'network' Date: Fri, 14 Feb 2020 17:26:21 +0100 Message-Id: <20200214162624.147825-4-pmores@redhat.com> In-Reply-To: <20200214162624.147825-1-pmores@redhat.com> References: <20200214162624.147825-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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: , 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-MC-Unique: YfyOV-ImO5CWkjDS9WVDzQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" QoS 'floor' setting is documented to be only supported for interfaces of type 'network'. Fail with an error message on attempt to set 'floor' on an interface of any other type. Signed-off-by: Pavel Mores Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2813f084cd..f686b858cf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11672,9 +11672,21 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, sizeof(*newBandwidth->out)); } =20 - if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK && - virDomainNetBandwidthUpdate(net, newBandwidth) < 0) - goto endjob; + if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK) { + if (virDomainNetBandwidthUpdate(net, newBandwidth) < 0) + goto endjob; + } else { + if (virNetDevBandwidthHasFloor(bandwidth)) { + char ifmac[VIR_MAC_STRING_BUFLEN]; + + virMacAddrFormat(&net->mac, ifmac); + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("Invalid use of 'floor' on interface with= MAC address %s " + "- 'floor' is only supported for interface = type 'network' with forward type 'nat', 'route', 'open' or none"), + ifmac); + goto endjob; + } + } =20 if (virNetDevBandwidthSet(net->ifname, newBandwidth, false, !virDomainNetTypeSharesHostView(net)) < = 0) { --=20 2.24.1 From nobody Thu Apr 25 21:46:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1581697622820488.67579538432676; Fri, 14 Feb 2020 08:27:02 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-IFYPmV__NoqTiLvm0VczlA-1; Fri, 14 Feb 2020 11:26:56 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42D90107ACCC; Fri, 14 Feb 2020 16:26:51 +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 14FE919C6A; Fri, 14 Feb 2020 16:26:51 +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 D87A518089C8; Fri, 14 Feb 2020 16:26:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01EGQXGi028536 for ; Fri, 14 Feb 2020 11:26:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id C17CF1001DF0; Fri, 14 Feb 2020 16:26:33 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 173E81001B28; Fri, 14 Feb 2020 16:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581697619; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4DEvaT/aDQgC3SX4zEuUhLTDZ6tjHOZuAUxwZ2DW9t0=; b=VgyLwvj3zApnN8xiu6YE8w7UXaUgeH/opYrUmm1fqdTeu/NQMrl+EJPeLttspaems8eFX6 oH9H9BmJ6vhVYntOO7qRxPuU/jtX65wHvlVKdXalK2ofgLFplOmBmUwI00P4VNFLcBDC39 IOW6SyitDF5VtoXfx/bt2FK8tW3Ctmc= From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/6] qemu: check if 'floor' is supported for given interface and network Date: Fri, 14 Feb 2020 17:26:22 +0100 Message-Id: <20200214162624.147825-5-pmores@redhat.com> In-Reply-To: <20200214162624.147825-1-pmores@redhat.com> References: <20200214162624.147825-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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: , 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-MC-Unique: IFYPmV__NoqTiLvm0VczlA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Even if an interface of type 'network', setting 'floor' is only supported if the network's forward type is nat, route, open or none. Signed-off-by: Pavel Mores Reviewed-by: Michal Privoznik --- src/network/bridge_driver.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 14976c9821..72220e1c64 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -5065,6 +5065,16 @@ networkCheckBandwidth(virNetworkObjPtr obj, =20 virMacAddrFormat(ifaceMac, ifmac); =20 + if (virNetDevBandwidthHasFloor(ifaceBand) && + !virNetDevSupportBandwidthFloor(def->forward.type)) { + + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("Invalid use of 'floor' on interface with MAC add= ress %s " + "- 'floor' is only supported for interface type '= network' with forward type 'nat', 'route', 'open' or none"), + ifmac); + return -1; + } + if (virNetDevBandwidthHasFloor(ifaceBand) && !(netBand && netBand->in)= ) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("Invalid use of 'floor' on interface with MAC " --=20 2.24.1 From nobody Thu Apr 25 21:46:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1581697615516366.946026355256; Fri, 14 Feb 2020 08:26:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-53ws-cFrNkK3mXGJxBDVxg-1; Fri, 14 Feb 2020 11:26:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EDF80800D5A; Fri, 14 Feb 2020 16:26:43 +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 B0DB889F3C; Fri, 14 Feb 2020 16:26:43 +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 5F1CD8B2CC; Fri, 14 Feb 2020 16:26:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01EGQY5l028542 for ; Fri, 14 Feb 2020 11:26:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA4041001E91; Fri, 14 Feb 2020 16:26:34 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E65F1001DDE; Fri, 14 Feb 2020 16:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581697614; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KMMHxERKgGDj1987q9duuWLTqcShMKA+eV8Yuw3nHZ4=; b=HUJ7+Ln9SrBEjBbEnlTmy96BlBfLArdxAJoJUR5b3ms8kOdUKXnbUuZ+DG0ybveJXqYd5u JbZLOQu/FGHPvB6YhF/9gl8VPSRpKByRHDRg4v1boWa+7bnkyO7akRwT7dCdJ7snkp1Sdu aap0PcUxChbG7geVinBNS55zgZ/O2o8= From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH v2 5/6] qemu: call networkPlugBandwidth() for all types of network Date: Fri, 14 Feb 2020 17:26:23 +0100 Message-Id: <20200214162624.147825-6-pmores@redhat.com> In-Reply-To: <20200214162624.147825-1-pmores@redhat.com> References: <20200214162624.147825-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 53ws-cFrNkK3mXGJxBDVxg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To fix the actual bug, it was necessary to make networkPlugBandwidth() be called also for 'bridge'-type networks implemented using macvtap's 'bridge' mode (previously it was only called for those implemented on top of an existing bridge). However, it seems beneficial to call it for other network types as well, at least because it removes an inconsistency in types of bandwidth configurati= on changes permissible in inactive and active domain configs. It should also = be safe as the function pretty much amounts to NOP if no QoS is requested and = the new behaviour should not be any worse than before if it is. Signed-off-by: Pavel Mores Reviewed-by: Michal Privoznik --- src/network/bridge_driver.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 72220e1c64..c8f7f07acb 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4571,8 +4571,6 @@ networkAllocatePort(virNetworkObjPtr obj, return -1; } =20 - if (networkPlugBandwidth(obj, &port->mac, port->bandwidth, &port->= class_id) < 0) - return -1; break; =20 case VIR_NETWORK_FORWARD_HOSTDEV: { @@ -4637,8 +4635,6 @@ networkAllocatePort(virNetworkObjPtr obj, } } =20 - if (networkPlugBandwidth(obj, &port->mac, port->bandwidth, &po= rt->class_id) < 0) - return -1; break; } =20 @@ -4736,6 +4732,11 @@ networkAllocatePort(virNetworkObjPtr obj, return -1; } =20 + + if (networkPlugBandwidth(obj, &port->mac, port->bandwidth, + &port->class_id) < 0) + return -1; + if (virNetworkObjMacMgrAdd(obj, driver->dnsmasqStateDir, port->ownername, &port->mac) < 0) return -1; --=20 2.24.1 From nobody Thu Apr 25 21:46:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 158169762720044.689620712561236; Fri, 14 Feb 2020 08:27:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-kW9BG_CqM1SNHdc4uk7yRw-1; Fri, 14 Feb 2020 11:27:03 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE070107ACC7; Fri, 14 Feb 2020 16:26:57 +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 A535490514; Fri, 14 Feb 2020 16:26:57 +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 56C0B18089D7; Fri, 14 Feb 2020 16:26:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01EGQZCG028550 for ; Fri, 14 Feb 2020 11:26:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA3D21001B28; Fri, 14 Feb 2020 16:26:35 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25EAB1001E91; Fri, 14 Feb 2020 16:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581697625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fheQf5Zlcu23m2XYVUmILVq7ZdSDrgDNJlzJp5LX5gg=; b=ZVIpO9RUIZXL4eDnLyF4Y1BiokHPkDvYdtkOvoCCoNIhsEZnYqydSYMop5BNd2cFVmVnpP Ey3hXkKKOIyD9b9umI3K+8p+2mfEIpJZxInguAkHP1w+nCGgZUrGN0vQW76cJbQGK7yNyb H5ozLJ8kW33gf8/BmjjIWNRDFDttWz8= From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH v2 6/6] docs: QoS parameter 'floor' is supported for 'open' networks too Date: Fri, 14 Feb 2020 17:26:24 +0100 Message-Id: <20200214162624.147825-7-pmores@redhat.com> In-Reply-To: <20200214162624.147825-1-pmores@redhat.com> References: <20200214162624.147825-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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: , 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-MC-Unique: kW9BG_CqM1SNHdc4uk7yRw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Relevant code seems to treat forward modes 'route', 'nat', 'open' and 'none' the same but documentation hasn't reflected that so far. Signed-off-by: Pavel Mores Reviewed-by: Michal Privoznik --- docs/formatnetwork.html.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 2448fb09e7..3d807ecab6 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -631,7 +631,7 @@ goes through one point where QoS decisions can take place, hence why this attribute works only for virtual networks for now (that is <interface type=3D'network'/> with a - forward type of route, nat, or no forward at all). Moreover, the + forward type of route, nat, open or no forward at all). Moreover= , the virtual network the interface is connected to is required to have at least inbound QoS set (average at least). If using the floor attribute users don't need to speci= fy --=20 2.24.1