From nobody Mon Apr 29 18:29:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=126.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1635909127791976.4613139782206; Tue, 2 Nov 2021 20:12:07 -0700 (PDT) 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-9-TT3o3Q-IMLKWSxrvH4u7KA-1; Tue, 02 Nov 2021 23:12:05 -0400 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 6291419057A0; Wed, 3 Nov 2021 03:11:58 +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 D6F6862A41; Wed, 3 Nov 2021 03:11:55 +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 E559A4A703; Wed, 3 Nov 2021 03:11:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A33Bl7l029251 for ; Tue, 2 Nov 2021 23:11:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1930A400DEF8; Wed, 3 Nov 2021 03:11:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1443E4010E79 for ; Wed, 3 Nov 2021 03:11:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF85C811E76 for ; Wed, 3 Nov 2021 03:11:46 +0000 (UTC) Received: from m15113.mail.126.com (m15113.mail.126.com [220.181.15.113]) by relay.mimecast.com with ESMTP id us-mta-540-qndP3nb6ObCmHbbuFerCcQ-1; Tue, 02 Nov 2021 23:11:45 -0400 Received: from zhangjl0200.home.langchao.com (unknown [223.104.194.145]) by smtp3 (Coremail) with SMTP id DcmowACHjvrn_YFhDiiMCQ--.28692S3; Wed, 03 Nov 2021 11:11:42 +0800 (CST) X-MC-Unique: TT3o3Q-IMLKWSxrvH4u7KA-1 X-MC-Unique: qndP3nb6ObCmHbbuFerCcQ-1 From: jx8zjs To: libvir-list@redhat.com Subject: [PATCH 1/1] bridge_driver: use ovs-vsctl to setup and clean Qos when Date: Wed, 3 Nov 2021 11:11:33 +0800 Message-Id: <20211103031133.499-2-jx8zjs@126.com> In-Reply-To: <20211103031133.499-1-jx8zjs@126.com> References: <20211103031133.499-1-jx8zjs@126.com> MIME-Version: 1.0 X-CM-TRANSID: DcmowACHjvrn_YFhDiiMCQ--.28692S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxZF1rJry8tF1UXrW3Jr43ZFb_yoWrWw17pF sagF95Ar48Wr4xKr43Ar4rC34UWa1vvrn5G3s7W3yjvry8Xa4fuw17Ww1jvr45urWfJr4f Ar1rZrZ5X3y2kFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bOXdbUUUUU= X-Originating-IP: [223.104.194.145] X-CM-SenderInfo: dm0y6ybv6rjloofrz/1tbi5A5ASFpECGVX6QAAsv X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-loop: libvir-list@redhat.com Cc: shenjiatong@inspur.com, zhangjl02@inspur.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1635909129529100001 Content-Type: text/plain; charset="utf-8" From: zhangjl02 Fix bug 1826168: bridge type network with ovs bridge can start with Qos setting which do not take any effect Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=3D1826168 Signed-off-by: zhangjl02 --- src/network/bridge_driver.c | 65 +++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 498c45d0a7..d0627848cd 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2305,6 +2305,15 @@ networkAddRouteToBridge(virNetworkObj *obj, } =20 =20 +static int +networkDefIsOvsBridge(virNetworkDef *def) +{ + const virNetDevVPortProfile *vport =3D def->virtPortProfile; + return vport && + vport->virtPortType =3D=3D VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH; +} + + static int networkStartNetworkVirtual(virNetworkDriverState *driver, virNetworkObj *obj) @@ -2320,6 +2329,7 @@ networkStartNetworkVirtual(virNetworkDriverState *dri= ver, bool dnsmasqStarted =3D false; bool devOnline =3D false; bool firewalRulesAdded =3D false; + bool ovsType =3D networkDefIsOvsBridge(def); =20 /* Check to see if any network IP collides with an existing route */ if (networkCheckRouteCollision(def) < 0) @@ -2439,15 +2449,29 @@ networkStartNetworkVirtual(virNetworkDriverState *d= river, if (v6present && networkStartRadvd(driver, obj) < 0) goto error; =20 - if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true) < 0) - goto error; + if (ovsType) { + if (virNetDevOpenvswitchInterfaceSetQos(def->bridge, def->bandwidt= h, + def->uuid, + true) < 0) + goto error; + } else { + if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true)= < 0) + goto error; + } =20 return 0; =20 error: virErrorPreserveLast(&save_err); - if (def->bandwidth) - virNetDevBandwidthClear(def->bridge); + if (ovsType) { + if (virNetDevOpenvswitchInterfaceClearQos(def->bridge, def->uuid) = < 0) + VIR_WARN("cannot clear bandwidth setting for ovs bridge : %s", + def->bridge); + } else { + if (def->bandwidth) { + virNetDevBandwidthClear(def->bridge); + } + } =20 if (dnsmasqStarted) { pid_t dnsmasqPid =3D virNetworkObjGetDnsmasqPid(obj); @@ -2536,13 +2560,21 @@ static int networkStartNetworkBridge(virNetworkObj *obj) { virNetworkDef *def =3D virNetworkObjGetDef(obj); + bool ovsType =3D networkDefIsOvsBridge(def); =20 /* 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. */ - if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true) < 0) - goto error; + if (ovsType) { + if (virNetDevOpenvswitchInterfaceSetQos(def->bridge, def->bandwidt= h, + def->uuid, + true) < 0) + goto error; + } else { + if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true)= < 0) + goto error; + } =20 if (networkStartHandleMACTableManagerMode(obj) < 0) goto error; @@ -2550,8 +2582,15 @@ networkStartNetworkBridge(virNetworkObj *obj) return 0; =20 error: - if (def->bandwidth) - virNetDevBandwidthClear(def->bridge); + if (ovsType) { + if (virNetDevOpenvswitchInterfaceClearQos(def->bridge, def->uuid) = < 0) + VIR_WARN("cannot clear bandwidth setting for ovs bridge : %s", + def->bridge); + } else { + if (def->bandwidth) { + virNetDevBandwidthClear(def->bridge); + } + } return -1; } =20 @@ -2565,9 +2604,15 @@ networkShutdownNetworkBridge(virNetworkObj *obj G_GN= UC_UNUSED) * type BRIDGE is shutdown. On failure, undo anything you've done, * and return -1. On success return 0. */ - if (def->bandwidth) - virNetDevBandwidthClear(def->bridge); =20 + if (networkDefIsOvsBridge(def)) { + if (virNetDevOpenvswitchInterfaceClearQos(def->bridge, def->uuid) = < 0) + VIR_WARN("cannot clear bandwidth setting for ovs bridge : %s", + def->bridge); + } else { + if (def->bandwidth) + virNetDevBandwidthClear(def->bridge); + } return 0; } =20 --=20 2.30.2.windows.1