From nobody Thu May 2 16:03:00 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=1568390826; cv=none; d=zoho.com; s=zohoarc; b=FYNeZsg5f4yP/a0nRaKFivhSNJtKjV03ED3URUBN08WPn2j1DNhNq5E8rxmHKo8lxIGdfohI1dVR3BByr/hhdlQym0HCrKdhfIvtRKvHcAtlQ44AToi3M00jkMDn8TeSUZ9Ds3d0GFwwvlPlQwfAFZKsTNiOVJSODDjz0TWTIY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568390826; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=Yk8Lq3EcaOOx/og/3EQwkHz3OAD8IsiV1vzJ8BfWwLE=; b=A7J1xYIco8mAp5qwyvcL8NnjHcxqKVRmd+7fGkcUjsubWkFKpBvWVayk8x5OfJ/M0kwRBUTlKkF1xmecNkWgdNeRCPOxbnVBisc26Y/bY+5D3gl1PixSx4R/92kk/yrQyQPGlaw1vM/0WRefffokCDGwlFMr+PQR8/6YHVVI3TU= 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 1568390826150449.86503591432165; Fri, 13 Sep 2019 09:07:06 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 7C3E13C935; Fri, 13 Sep 2019 16:07:04 +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 47C9A600C6; Fri, 13 Sep 2019 16:07:04 +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 D47382551C; Fri, 13 Sep 2019 16:07:03 +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 x8DG5b0o008845 for ; Fri, 13 Sep 2019 12:05:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 53E491001B09; Fri, 13 Sep 2019 16:05:37 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (dhcp-94.gsslab.fab.redhat.com [10.33.9.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id B93191001B02; Fri, 13 Sep 2019 16:05:36 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 13 Sep 2019 17:05:35 +0100 Message-Id: <20190913160535.14779-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] network: apply bandwidth settings for forward mode=bridge 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-Type: text/plain; charset="utf-8" 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 13 Sep 2019 16:07:04 +0000 (UTC) We previously allowed bandwidth settings when attaching NICs to networks with forward mode=3Dbridge: commit 42a92ee93d5432ebd9ebfd409903b5287fc7d7ff Author: Daniel P. Berrang=C3=A9 Date: Tue Nov 20 11:30:05 2018 +0000 network: add missing bandwidth limits for bridge forward type In the case of a network with forward=3Dbridge, which has a bridge devi= ce listed, we are capable of setting bandwidth limits but fail to call the function to register them. Reviewed-by: Cole Robinson Signed-off-by: Daniel P. Berrang=C3=A9 Unfortunately the wrong version of this patch was posted and reviewed and thus it lacked the code to actually apply the bandwidth settings to the bridge itself. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 0fee153cb8..6a97bb17e2 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2743,21 +2743,39 @@ networkShutdownNetworkVirtual(virNetworkDriverState= Ptr driver, static int networkStartNetworkBridge(virNetworkObjPtr obj) { + virNetworkDefPtr def =3D virNetworkObjGetDef(obj); + /* put anything here that needs to be done each time a network of * type BRIDGE, is started. On failure, undo anything you've done, * and return -1. On success return 0. */ - return networkStartHandleMACTableManagerMode(obj, NULL); + if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true) < 0) + goto error; + + if (networkStartHandleMACTableManagerMode(obj, NULL) < 0) + goto error; + + return 0; + + error: + if (def->bandwidth) + virNetDevBandwidthClear(def->bridge); + return -1; } =20 =20 static int networkShutdownNetworkBridge(virNetworkObjPtr obj ATTRIBUTE_UNUSED) { + virNetworkDefPtr def =3D virNetworkObjGetDef(obj); + /* put anything here that needs to be done each time a network of * type BRIDGE is shutdown. On failure, undo anything you've done, * and return -1. On success return 0. */ + if (def->bandwidth) + virNetDevBandwidthClear(def->bridge); + return 0; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list