From nobody Mon Feb 9 06:02:15 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1712917394676159.75266053019482; Fri, 12 Apr 2024 03:23:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 93E481815; Fri, 12 Apr 2024 06:23:13 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 10CB5187E; Fri, 12 Apr 2024 06:19:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 463CE17D3; Fri, 12 Apr 2024 06:19:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2C9AF17D5 for ; Fri, 12 Apr 2024 06:19:11 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-jAMrEUjPPsqbz037T3onrw-1; Fri, 12 Apr 2024 06:19:09 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2A6281C07F30 for ; Fri, 12 Apr 2024 10:19:09 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id C966A1C060D1 for ; Fri, 12 Apr 2024 10:19:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: jAMrEUjPPsqbz037T3onrw-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 4/5] conf: Move virDomainClearNetBandwidth() to src/hypervisor/ Date: Fri, 12 Apr 2024 12:19:04 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: NP525HKRECLW4YFY7QY4A5IPISM66KQT X-Message-ID-Hash: NP525HKRECLW4YFY7QY4A5IPISM66KQT X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1712917394864100001 The reason virDomainClearNetBandwidth() exists in src/conf/ is that at the time its introduction we did not have a better place. But now we do. Firstly, virDomainClearNetBandwidth() is hypervisor agnostic code, but really has nothing to do with domain configuration (it doesn't parse/format XML). Secondly, in near future it'll call another function from src/hypervisor/ and that's not really allowed from src/conf/. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/netdev_bandwidth_conf.c | 14 -------------- src/conf/netdev_bandwidth_conf.h | 3 --- src/hypervisor/domain_interface.c | 16 ++++++++++++++++ src/hypervisor/domain_interface.h | 2 ++ src/libvirt_private.syms | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_c= onf.c index cdf289270a..9faa46a27f 100644 --- a/src/conf/netdev_bandwidth_conf.c +++ b/src/conf/netdev_bandwidth_conf.c @@ -199,20 +199,6 @@ virNetDevBandwidthFormat(const virNetDevBandwidth *def, return 0; } =20 -void -virDomainClearNetBandwidth(virDomainDef *def) -{ - size_t i; - virDomainNetType type; - - for (i =3D 0; i < def->nnets; i++) { - type =3D virDomainNetGetActualType(def->nets[i]); - if (virDomainNetGetActualBandwidth(def->nets[i]) && - virNetDevSupportsBandwidth(type)) - virNetDevBandwidthClear(def->nets[i]->ifname); - } -} - =20 bool virNetDevSupportsBandwidth(virDomainNetType type) { diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_c= onf.h index c698cc9dbc..b679b0f51f 100644 --- a/src/conf/netdev_bandwidth_conf.h +++ b/src/conf/netdev_bandwidth_conf.h @@ -34,9 +34,6 @@ int virNetDevBandwidthFormat(const virNetDevBandwidth *de= f, unsigned int class_id, virBuffer *buf); =20 -void virDomainClearNetBandwidth(virDomainDef *def) - ATTRIBUTE_NONNULL(1); - bool virNetDevSupportsBandwidth(virDomainNetType type); bool virNetDevBandwidthHasFloor(const virNetDevBandwidth *b); bool virNetDevBandwidthSupportsFloor(virNetworkForwardType type); diff --git a/src/hypervisor/domain_interface.c b/src/hypervisor/domain_inte= rface.c index ccf4cb94bd..0a9cad8011 100644 --- a/src/hypervisor/domain_interface.c +++ b/src/hypervisor/domain_interface.c @@ -27,6 +27,7 @@ #include "domain_driver.h" #include "domain_interface.h" #include "domain_nwfilter.h" +#include "netdev_bandwidth_conf.h" #include "network_conf.h" #include "viralloc.h" #include "virconftypes.h" @@ -469,3 +470,18 @@ virDomainInterfaceDeleteDevice(virDomainDef *def, } =20 } + + +void +virDomainClearNetBandwidth(virDomainDef *def) +{ + size_t i; + virDomainNetType type; + + for (i =3D 0; i < def->nnets; i++) { + type =3D virDomainNetGetActualType(def->nets[i]); + if (virDomainNetGetActualBandwidth(def->nets[i]) && + virNetDevSupportsBandwidth(type)) + virNetDevBandwidthClear(def->nets[i]->ifname); + } +} diff --git a/src/hypervisor/domain_interface.h b/src/hypervisor/domain_inte= rface.h index 8047fdadfa..bb212cf3b8 100644 --- a/src/hypervisor/domain_interface.h +++ b/src/hypervisor/domain_interface.h @@ -44,3 +44,5 @@ void virDomainInterfaceDeleteDevice(virDomainDef *def, virDomainNetDef *net, bool priv_net_created, char *stateDir); +void virDomainClearNetBandwidth(virDomainDef *def) + ATTRIBUTE_NONNULL(1); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8642305a8b..328f5b347b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -813,7 +813,6 @@ virDomainMomentDefPostParse; =20 =20 # conf/netdev_bandwidth_conf.h -virDomainClearNetBandwidth; virNetDevBandwidthFormat; virNetDevBandwidthHasFloor; virNetDevBandwidthParse; @@ -1635,6 +1634,7 @@ virDomainDriverParseBlkioDeviceStr; virDomainDriverSetupPersistentDefBlkioParams; =20 # hypervisor/domain_interface.h +virDomainClearNetBandwidth; virDomainInterfaceDeleteDevice; virDomainInterfaceEthernetConnect; virDomainInterfaceIsVnetCompatModel; --=20 2.43.2 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org