From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374217830628.7289837636288; Tue, 3 Sep 2024 07:36:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B3FF714CF; Tue, 3 Sep 2024 10:36:56 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 716571248; Tue, 3 Sep 2024 10:36:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9C106D8F; Tue, 3 Sep 2024 10:36:35 -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 37BF511ED for ; Tue, 3 Sep 2024 10:36:35 -0400 (EDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-258-TLLVUn4PNcm61ayu6Ge4vA-1; Tue, 03 Sep 2024 10:36:33 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42bac946976so50225445e9.2 for ; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42c800554d6sm90765275e9.43.2024.09.03.07.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:31 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 17C2C1FC90B9 for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374194; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jqGyL9QQTGSwV5yRjGb978x8TTT8owWAVxXv8aqPWak=; b=NC/riFU56iij7HkfFgt4EnC38k8WaUuEQnfCRrsyUQwOo+6QlbThYKc5O6uS4F6BNECCcD G4xF4Q3N3hPxqolPH8Nj5v26IJv6z0TyNh2Cdzfy6txi37N8WApUM3KgnCihgj0pdKx9fr xY4/UyJ6VldjYXj/5NwVKrhLOW6DEIg= X-MC-Unique: TLLVUn4PNcm61ayu6Ge4vA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374192; x=1725978992; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jqGyL9QQTGSwV5yRjGb978x8TTT8owWAVxXv8aqPWak=; b=dOUMTJe29dlUdLlW+qhsAKpOAhfEJAFZCohnCib6222W9Z8TxzC2uyH5SIXKEgcQna bY+ZljiICBx8vsEKu/jETSY79xZ/ng0UvTokp3oB8Ob5CMg4Z0LS4aWtlfEWMunF7y6O swSNdYUaU2vu1x76GiNewq/OExKFko/lNoHnnvf44p4Cp8BP05Fu/UgthuTewlBhpawL Dsix6faA853BOv4N3vsFnrhVuJ9WD7nW2vk7OAsAAIzwvaR83pCu5nGw7PvWi3snqZ3n 5c1iqjz41OjIO0eyG21JbaEEaBP5yj5a7K5DlteDKAuF2Jb4zm1pn4B812iecHSgxKsH ONSQ== X-Gm-Message-State: AOJu0YzrnqIoAZ5FkSsuRrCNIoGaQGWSv0+si4SFkdRdFnWhNk1t06Av 2i2c3qbmCp1mNYWaIMyQZOi+tpogqdCOaFezdEvLVq/D7cBimXcrEUvFE3SBYruwMbpVOjJnPa3 vW+ufedscPFS2wmEWHtrxIa0xVnVilVRgl9Sr870uo1LEyQv7MbtryJm8PiafxHWEjGyryUd94m VcXejbnlGIqZH0uHwXpKWIMh4qqUCwEj48pv8l0VU= X-Received: by 2002:a05:600c:4685:b0:428:150e:4f13 with SMTP id 5b1f17b1804b1-42bb27bc4cbmr116780145e9.33.1725374192533; Tue, 03 Sep 2024 07:36:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuiC4er+QvlkIGY9wlPozuG2buv4f321SmuzF5plas+hQaPHDQlwXB/QsUOP95+qgf32zpVA== X-Received: by 2002:a05:600c:4685:b0:428:150e:4f13 with SMTP id 5b1f17b1804b1-42bb27bc4cbmr116779905e9.33.1725374191767; Tue, 03 Sep 2024 07:36:31 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 1/8] network: Do not update network ports for inactive networks Date: Tue, 3 Sep 2024 16:36:20 +0200 Message-ID: <64fd916836e06e38f15da6302d6b5dd18dfe39f1.1725373964.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: I7ZNU4RNQFKDV7FM4SUNE5GGPXGVVJP4 X-Message-ID-Hash: I7ZNU4RNQFKDV7FM4SUNE5GGPXGVVJP4 X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374220183116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The semantic does not change since inside networkUpdatePort() (well, networkNotifyPort, for which the former is a wrapper) exits for inactive networks, but with an error we can easily avoid with this patch. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 915211d1b590..5b510a222cd2 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -489,7 +489,8 @@ networkUpdateState(virNetworkObj *obj, return -1; } =20 - virNetworkObjPortForEach(obj, networkUpdatePort, obj); + if (virNetworkObjIsActive(obj)) + virNetworkObjPortForEach(obj, networkUpdatePort, obj); =20 /* Try and read dnsmasq pids of active networks */ if (virNetworkObjIsActive(obj) && def->ips && (def->nips > 0)) { --=20 2.46.0 From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374266864410.94275270471996; Tue, 3 Sep 2024 07:37:46 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C9E9013E1; Tue, 3 Sep 2024 10:37:45 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A5C061412; Tue, 3 Sep 2024 10:36:45 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4489F1211; Tue, 3 Sep 2024 10:36:36 -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 E01BD11ED for ; Tue, 3 Sep 2024 10:36:35 -0400 (EDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-10-Qa92AQ-BMZieui1fpPGxGA-1; Tue, 03 Sep 2024 10:36:34 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42c7bc97425so15327675e9.1 for ; Tue, 03 Sep 2024 07:36:34 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bbc36bd88sm145317925e9.24.2024.09.03.07.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:31 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 23ADE1FC90BA for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7lQdQZft23EOiwPyEFZP++COpLgKihv3EnesG3KiZXY=; b=hsh6ryqDK3e2EEhX7qLyB8uoI6VIHo+qaLHybpFgFMRimC+olTQWICk34SsWKSnSkU+h/R ynNJ4RBNMVD3QjHZeOMm7YVeOfTb5OolouyH6/LVVoaSXZZgHenuE8zIaRePE9IYZlcEIy EVRF/HZTf6NG2x9+PUlS0Kqkur0uD7g= X-MC-Unique: Qa92AQ-BMZieui1fpPGxGA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374193; x=1725978993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7lQdQZft23EOiwPyEFZP++COpLgKihv3EnesG3KiZXY=; b=v1D1+rPbSXaPv4j778bqr2mT+p4+s+qGYm1wcxangegn81+3+spStw83Nus0H5w5JB iZ04yyKu4nE6F7r75hPOrqLnRMHBJocWPlRPPeFqNU2JQtvVE0DkgKWLBEXK40d9/F37 fYz53YHFJf7+qJ0z+ZzRyfoy1bhQSNj19r34FmcaaUHMvGQmwJ5k8g0HurWkv8HjUJ0V 0Q5EtGxnXHWpcCgQiW4xM8aoMxdOLJBkeGgSgrs++cu1+/fjvpMWswFlcRZ3E+LGqTaW H/0EAgtuIdlpp/mqPjgWKzWoctLWelnj88lm34NHQ71WjR8hcgdDCZ3u4OsHM+ywqLSA au2Q== X-Gm-Message-State: AOJu0YxTbCqmQ5pAa8OoApYPmPPO4C4NYhf8taK9eO0l+DfFluvGWMTZ Ugi2sZkpCFovkY3ES14WObVdamxa/JX9Yrxm7qSRkVu7luMxa1/GEHgqEAfRkSPkPqdBA17yPiQ xrMnLgbgoWyEShuVMVeX4bauFyRO5q2T1m9P4EnXvMF0M5MQqwic7VaTyKL43VqOu8n7J9/TeTi /nnStfgYTyPw4Qml4XflRWRRyj2q4am01UVhpuLIM= X-Received: by 2002:a05:600c:3110:b0:428:6ac:426e with SMTP id 5b1f17b1804b1-42bb4c4c3famr108139595e9.5.1725374193069; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdInOqJkl5kFRVckYJruyxPTZCc4oNYaXU1pc7Pi2O4oCZKJNOTil/q3bQGKXi5g0KrxOJnw== X-Received: by 2002:a05:600c:3110:b0:428:6ac:426e with SMTP id 5b1f17b1804b1-42bb4c4c3famr108139255e9.5.1725374192181; Tue, 03 Sep 2024 07:36:32 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 2/8] network: Do not call virNetworkObjUnsetDefTransient on start cleanup Date: Tue, 3 Sep 2024 16:36:21 +0200 Message-ID: <03b3cb317750e1cb4e2cbb5a2d9da876cac6a99d.1725373964.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 247W5KPE4MHCKRHBZOKCDEQ3IBEQY7LN X-Message-ID-Hash: 247W5KPE4MHCKRHBZOKCDEQ3IBEQY7LN X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374268113116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The function networkShutdownNetwork already does that. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 5b510a222cd2..b16d524aa181 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2387,7 +2387,6 @@ networkStartNetwork(virNetworkDriverState *driver, virErrorPtr save_err; =20 virErrorPreserveLast(&save_err); - virNetworkObjUnsetDefTransient(obj); networkShutdownNetwork(driver, obj); virErrorRestore(&save_err); } --=20 2.46.0 From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374284251712.2247303175324; Tue, 3 Sep 2024 07:38:04 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 331761491; Tue, 3 Sep 2024 10:38:03 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4B0AE14B6; Tue, 3 Sep 2024 10:36:47 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 86FF31211; Tue, 3 Sep 2024 10:36:36 -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 145DE121A for ; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-14-_AlljXJgNFSCaB54aLFYgg-1; Tue, 03 Sep 2024 10:36:34 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-374ba33b2d2so2464717f8f.2 for ; Tue, 03 Sep 2024 07:36:34 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-374c5ae48e4sm7633749f8f.90.2024.09.03.07.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:31 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 30EB51FC90BB for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=weJ77BxrtsJqnkJ7dxNx7kJh/xMvsJCd53Ey/rOVTQQ=; b=LHtLZZTE5ZzSjYyG8XETj9YfTqxrrHcPRDjjdWoGTTW1WJLvOiktNEOUUuLBTKeO46QWp6 thUI6WAlCrKQ90Za7a9JQdC1RuddX9ptqKLjdlS6G9OTtRJo12AYxlSIe+5ClQRct7V0qR rI7d7CfPZ7wRCpSgLiKNwIcaZoJ1aWY= X-MC-Unique: _AlljXJgNFSCaB54aLFYgg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374193; x=1725978993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=weJ77BxrtsJqnkJ7dxNx7kJh/xMvsJCd53Ey/rOVTQQ=; b=XsHPMv7ZdZtF7AWmMDt3moVAj7nHByQ9fxAc8ToPDF/0k1pp4EQVroygRr2m2X/UMe jTq1MIGSjE6BG48pgp8Ri63/pAo9GwXeZL/7rWEKSqT1W5brFK37lhBdsmDeFCpi5Rwy rkrMxNkhaBEXKjqMahzjQEHiE/LVmiRVSAl6EqQUAhMR5cd8o/hkhcD3F30Jp7vt0F50 SZpVe16Cvu1kp/WuvBElzSnuY1vMRT+3CTP+9sTPfiYLv9rYllDrdxu2iDQmWvL4adpY TwwCHcDN6YVVxsxV+EuF6E0Gh64iXnQkv+SPFpGyLv28p6YsJyWNJoBjGZOgWaESasSp /D2Q== X-Gm-Message-State: AOJu0YxtTlNIAT/AhaMGvBmxq14Zx/1cciAiLaVXM9cxerVxMYlEoJOf H1BJ1bMi1OV7/ASBe66YVDMiTYJbAEvdhMJAm9adQ/aPNFqgqz2CTasoLmbcN0CpOn93BHDHTZf Mnt97ID0DhCyR2+CTPnCUkMQcToVRJoAVqT8Y4Uob0nXZzndYX68xEpjnejHBNaQH5n0Nu47x2+ kKx/xpo8WutPPeYaZOmyGFssKhwy74SG9xYUWUdPk= X-Received: by 2002:adf:a30c:0:b0:374:baf1:41cb with SMTP id ffacd0b85a97d-374ecc67bacmr2737269f8f.4.1725374193214; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECR2JMEdbTI82ELhQaGdfwspnLauvMUGPy+3szORxAzrRLFL7+itNz0DfRmdBPz3zep4tJ2g== X-Received: by 2002:adf:a30c:0:b0:374:baf1:41cb with SMTP id ffacd0b85a97d-374ecc67bacmr2737235f8f.4.1725374192369; Tue, 03 Sep 2024 07:36:32 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 3/8] network: Move port deletion into the shutdown function Date: Tue, 3 Sep 2024 16:36:22 +0200 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GNPQIR72PII7TD72B2O5T547LTJ566ZV X-Message-ID-Hash: GNPQIR72PII7TD72B2O5T547LTJ566ZV X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374286207116600 Content-Type: text/plain; charset="utf-8"; x-default="true" It will be more useful in there when calling from new places. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index b16d524aa181..d27a7e9b88c4 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2447,6 +2447,8 @@ networkShutdownNetwork(virNetworkDriverState *driver, return -1; } =20 + virNetworkObjDeleteAllPorts(obj, cfg->stateDir); + /* now that we know it's stopped call the hook if present */ networkRunHook(obj, NULL, VIR_HOOK_NETWORK_OP_STOPPED, VIR_HOOK_SUBOP_END); @@ -3458,8 +3460,6 @@ networkDestroy(virNetworkPtr net) if ((ret =3D networkShutdownNetwork(driver, obj)) < 0) goto cleanup; =20 - virNetworkObjDeleteAllPorts(obj, cfg->stateDir); - /* @def replaced in virNetworkObjUnsetDefTransient */ def =3D virNetworkObjGetDef(obj); =20 --=20 2.46.0 From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374251223864.8449608717659; Tue, 3 Sep 2024 07:37:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1541E128C; Tue, 3 Sep 2024 10:37:30 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CF840139C; Tue, 3 Sep 2024 10:36:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1C3591211; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 A26F61207 for ; Tue, 3 Sep 2024 10:36:35 -0400 (EDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-393-TMpFyh2PNdCFKm7_M2bNuQ-1; Tue, 03 Sep 2024 10:36:34 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42ac185e26cso49818975e9.3 for ; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e2737dsm173003805e9.29.2024.09.03.07.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:31 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 3CEA01FC90BC for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EsmAddusS+N64d1JZASWU+iA3EUUXqUND7ALLRSbHKs=; b=Z9LWGpEry3zxzR4mZ+To333YXrQQv/cD9HFopL9PTS7qkadohJo4Syd5d0Qa+pnTJjTQXV hehjdNnPGWdW5lryUZ8Za0WPcp3bOYVph6O2wVTuOJA7cgA/CQr9BEC0OnnQTWzm523MBJ bSb5KgSfgMA0L+UlnK42u1gssgzrRxo= X-MC-Unique: TMpFyh2PNdCFKm7_M2bNuQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374193; x=1725978993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EsmAddusS+N64d1JZASWU+iA3EUUXqUND7ALLRSbHKs=; b=NZoxwxPw6eDLoesETrZmjGNfiBnLBaOreslExVSD2L0P+xVcs2uKAT6SlhCDF5vRGf z6UbV2xA1YuERFJ7gm4u30b23xygXSsWf4nvbQ2qGndnhCrc+urNkwVF2D06UqvJ14D+ dOscGy/PkxdeccS25O57KfHLv4z/a/9kcB7F6YnwkJSIrcwpQR9yDCXohMm2a27aTNWd Z+1BUPcR3FH+vb8BeaNLhuZb3vBtxjbIPL+7ZDSuUA9qJJPmXTu1lgsxSauIOgVm+Hxo AGa9lkcEX1P9EUBcdZxsoT2mbR364S3MPhmtHtk0RqBx+Bp8dRbP0W/3QPKDOQjMY8TG tUDg== X-Gm-Message-State: AOJu0YxlsmkB3RFxEz4vniN4mDDuREEWdkh8gqlOoUkmsQLwixvotw4x o3XnraSReZiFQ4NVKFyYLHMkhKQPhIwas50MuU4Eyqd3ATwYwP+pXL+V9m/HQVh5nQ3EJxG3m1m 3ADR7oQzRsKvJB+hj/o2ZEo0EGpfsNCmzyZbFJsaZVPmXMXO5x39+/Ln4TGpnLhvuRc1bZ2XVrt rdoZPm28Y4adO8SvFQLE9a7nFdT4fyZttlW7OAluY= X-Received: by 2002:a05:600c:1d85:b0:426:6f62:3bc1 with SMTP id 5b1f17b1804b1-42bbb10d2c8mr102644505e9.5.1725374192930; Tue, 03 Sep 2024 07:36:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDZn4fOSJMppZ8ZF1N2simaiuX2+7tVSZPp/8R1ljQGjrdKB62HdAt9UfhAEuRKmGin6G0uQ== X-Received: by 2002:a05:600c:1d85:b0:426:6f62:3bc1 with SMTP id 5b1f17b1804b1-42bbb10d2c8mr102644235e9.5.1725374192211; Tue, 03 Sep 2024 07:36:32 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 4/8] network: Don't check if network is active in networkShutdownNetwork Date: Tue, 3 Sep 2024 16:36:23 +0200 Message-ID: <6ef41a47d1d7694bc3fcc0e12ddf737909a37593.1725373964.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: S37JGEC2MSIYZ5JBQ34AIPWOXLQILY3U X-Message-ID-Hash: S37JGEC2MSIYZ5JBQ34AIPWOXLQILY3U X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374252097116600 Content-Type: text/plain; charset="utf-8"; x-default="true" It skips the cleanup from networkStartNetwork and the only other path already checks if the network is active or not. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index d27a7e9b88c4..e507dcd4c5c9 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2405,9 +2405,6 @@ networkShutdownNetwork(virNetworkDriverState *driver, =20 VIR_INFO("Shutting down network '%s'", def->name); =20 - if (!virNetworkObjIsActive(obj)) - return 0; - stateFile =3D virNetworkConfigFile(cfg->stateDir, def->name); if (!stateFile) return -1; --=20 2.46.0 From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374320902351.07144333428937; Tue, 3 Sep 2024 07:38:40 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D5DF81406; Tue, 3 Sep 2024 10:38:39 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 37198D59; Tue, 3 Sep 2024 10:36:51 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B4137BD7; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 5E5ABD8F for ; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-455-DZkQqUoZPKeOTW8FHm8eMg-1; Tue, 03 Sep 2024 10:36:34 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42bbf928882so36052005e9.1 for ; Tue, 03 Sep 2024 07:36:34 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3749ee9ba8esm14444244f8f.50.2024.09.03.07.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:32 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 4940D1FC90BD for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LiKIdGH/9WcfsqQ6FJfTFxnT2T7Rb+uYqiidd399YMg=; b=HLPZNaImtj50pgA/yfMpmiSA4XSJrrhwNb98gqzy/S2rXqhWkvBDEYpIltYy8hTugbMlpd fRMdMvt/wIp83cGUksw1UkjqonWuxJMG47a+Ju0roPtub+4l75Dv4vztDlESd1akOTipxN UqAKgnZiFZVRmijabwuWGZfaF0jQAA0= X-MC-Unique: DZkQqUoZPKeOTW8FHm8eMg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374193; x=1725978993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LiKIdGH/9WcfsqQ6FJfTFxnT2T7Rb+uYqiidd399YMg=; b=uOQav3Rozy9+V7Cmw72iMlyk+hRRGlXrTSSl8gLKbJy7yCc41UVdRla0ZUvEjHAsvo nXOB4avlcqdB0vd/BKPeIet2WSasEq/WrjWmHqijZSylv8TS4VY2iST0v+opud6lCdWt ozSX15cwLHJZceA4DHgkQGffaV6D4hD8sZdP5aFyzfM6Cz4iiCl9dfrKi/O6ZYOFDDcG SG1hWAzANhYTm440lvde4WX0eDnzGeqlcCQoBpg+0DiHtQRDti+HK+4Gl2xwqFA0mTGM uFZePSAmNA1OW2AaNmjPtYAyd8LfDa333Bz3P2bSTFy2nwUT5rPikd4HX+1WkMnHgwcI EBqA== X-Gm-Message-State: AOJu0YxkNTMHx0g0hVxc1+8ubUhM4CZmDhevWeasm0VsYUhkrIRP2FPB XGSOpa0PPxts57yT4a0UG9j7btDGSf77i0qnvl6NqEx6b9JmZE+R6CMUPHHWHTXEvs9TTODkt/P shHrQH3KJE3lXulFw+l4Pnf/vvqdtgrMSve3/xo45Zh0cjVaaAXD6MYUJv2WT5Kdhtkqfa1vZgg mwSAuPz4ntybtamiEg6f3vekzaehVZkQ+F6LzEUTI= X-Received: by 2002:adf:f0cf:0:b0:374:b9a7:5ed6 with SMTP id ffacd0b85a97d-376dd15a94bmr846727f8f.22.1725374193497; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEyUC2Bhr/BV+XxJ6+z1eqXvEQaJJ17zn1fCvtDNEg8LW66yvUNiWI31dmynjqAP7ELRF9/Q== X-Received: by 2002:adf:f0cf:0:b0:374:b9a7:5ed6 with SMTP id ffacd0b85a97d-376dd15a94bmr846694f8f.22.1725374192838; Tue, 03 Sep 2024 07:36:32 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 5/8] network: Clean up after inactive objects during start Date: Tue, 3 Sep 2024 16:36:24 +0200 Message-ID: <9df782e91f3c8a30a2c53da7f78db572d7f4a01c.1725373964.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5YL2XVZHVXTWENLEKVWAAP4ILQB6ABC7 X-Message-ID-Hash: 5YL2XVZHVXTWENLEKVWAAP4ILQB6ABC7 X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374322525116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Once networkUpdateState() identifies a dead network it should clean up after it as well. Resolves: https://issues.redhat.com/browse/RHEL-50968 Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index e507dcd4c5c9..ebdb39d0743b 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -510,6 +510,12 @@ networkUpdateState(virNetworkObj *obj, virNetworkObjSetDnsmasqPid(obj, dnsmasqPid); } =20 + /* Clean up after networks which were active but we have found out the= y are + * actually down */ + if (!virNetworkObjIsActive(obj)) { + networkShutdownNetwork(driver, obj); + } + return 0; } =20 --=20 2.46.0 From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374301114816.4662011527462; Tue, 3 Sep 2024 07:38:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0C5251256; Tue, 3 Sep 2024 10:38:20 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id F10F911ED; Tue, 3 Sep 2024 10:36:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8CAB31211; Tue, 3 Sep 2024 10:36:36 -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 27D6FBD7 for ; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-xYZPqsesMOuHvCUTkSNAjw-1; Tue, 03 Sep 2024 10:36:34 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3756212a589so905584f8f.2 for ; Tue, 03 Sep 2024 07:36:34 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3749ef7ea91sm14519680f8f.78.2024.09.03.07.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:32 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 554F01FC90BE for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=97nF6wI/FyurHDcFf9I5jqE7kOLgtl2ArJHHIu4TC+8=; b=Sxaoj7oOIOUz5eqCZwALfDMzuSyTbcXNe96OHxOglyaz4V8uh9v0vZL9NubaI16Dyt3gFW /gifW4Ejh7GONeQvXwhTvalXG3MOzuoGbpIlKSRJuBQVKK7l1k2mQM2N7G+F3El2az3kqt JIm7Z+IhAGtmS51nBT8FeRwdFs+Qbks= X-MC-Unique: xYZPqsesMOuHvCUTkSNAjw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374193; x=1725978993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=97nF6wI/FyurHDcFf9I5jqE7kOLgtl2ArJHHIu4TC+8=; b=Nelx+uifyWTfiqfdSFzCDq25o9km5JHD36l6bht5yKD65MqqDNtz8Fn96cVnURmRX7 9fD9RmEiwXFoSYCsVKAYjpoYUjxkZw/BnO/4Z90yRq/glrJAS1JNvKWnbb1kfGbnLqDW mGBb423F7iP3lvENO9WmET2LOSHD9+ZhTqitH6DB6FThBzymiotDDrx/s0k9VW4k6AZ7 q/6Tm6NsAJvBymMKISUeJ2mjrZYypGAIN4njV0HdSuAnLE/C8YNI0uw8afXBXTgh/lAp yCIAc8z4/6TraEUEIUnRjg1XEVtFrOrVTVyps/WQHRdUEVgT1Kqs/HagunolEWXg3n6H jWyg== X-Gm-Message-State: AOJu0YzTuvRllZnOZ6ZshctuH2UAp/b7+A768Q5MqMOOaPqj6pZFVWjA HK5WBLo83wMgmoFeNEftIBfp0zzhWKF/HZBruPiqD0jZulKNfn7ZxzgvKHZnQ+Lknv55FLL9kkB zFip36tj38Nrvvnfx6VESlhd1p3V95Xho6JBhjHkWKq1ykQY9pTHtcolQadVFGdhnhBqpuyvIAQ +C8BjYSN58c52O5BsWYlmGgUesQH4bAME6Q01CNBM= X-Received: by 2002:a5d:5c87:0:b0:374:c8eb:9b18 with SMTP id ffacd0b85a97d-374c8eb9b69mr5119178f8f.24.1725374193306; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpUW472cSVTKcnX2NBUMFnga+wm3sJqxvU+2hb4W6ukz+bC8Vzr98duZZa7IB+SptpyWKtXQ== X-Received: by 2002:a5d:5c87:0:b0:374:c8eb:9b18 with SMTP id ffacd0b85a97d-374c8eb9b69mr5119148f8f.24.1725374192645; Tue, 03 Sep 2024 07:36:32 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 6/8] network: Try to read dnsmasq PIDs for inactive networks too Date: Tue, 3 Sep 2024 16:36:25 +0200 Message-ID: <874fb08a6b9592166f102bc40dd2f28481509af7.1725373964.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: E26C2XBHARZWW77GCBLIQU5LCVHU3M7N X-Message-ID-Hash: E26C2XBHARZWW77GCBLIQU5LCVHU3M7N X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374302250116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Just in case one needs a clean up. Resolves: https://issues.redhat.com/browse/RHEL-50968 Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index ebdb39d0743b..3ef3444da241 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -492,8 +492,9 @@ networkUpdateState(virNetworkObj *obj, if (virNetworkObjIsActive(obj)) virNetworkObjPortForEach(obj, networkUpdatePort, obj); =20 - /* Try and read dnsmasq pids of active networks */ - if (virNetworkObjIsActive(obj) && def->ips && (def->nips > 0)) { + /* Try and read dnsmasq pids of both active and inactive networks, jus= t in + * case a network became inactive and we need to clean up. */ + if (def->ips && (def->nips > 0)) { const char *binpath =3D NULL; pid_t dnsmasqPid; =20 --=20 2.46.0 From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374337341977.6901254699933; Tue, 3 Sep 2024 07:38:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 410321463; Tue, 3 Sep 2024 10:38:56 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EE18713AB; Tue, 3 Sep 2024 10:36:53 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E2F4FD8F; Tue, 3 Sep 2024 10:36:36 -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 87406121A for ; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-tSF1KWqJPyKjDD4KHSVtvQ-1; Tue, 03 Sep 2024 10:36:35 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42bb68e1706so49978305e9.3 for ; Tue, 03 Sep 2024 07:36:34 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6df936dsm172780825e9.28.2024.09.03.07.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:32 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 61DEE1FC90BF for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+naiJ2trfEISuYHH58LDgy+P4YyFdOzDUecW4VfSij4=; b=IG83XA5x3n7pyh3Locg5n5UaTYVNAaSZtPq7QY1OJDl3k2PvXClok90k+OwbthI/LgjdaJ T3PnrkS6ueCnrpD970PMWrIIF+7x9/QHnRXA6vjEeDrhjdYaDaWY/XJtzs7u3wtyP/Zlk6 L5RJNSPqGjDixFIfzCfdOKnpdSU+xMk= X-MC-Unique: tSF1KWqJPyKjDD4KHSVtvQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374194; x=1725978994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+naiJ2trfEISuYHH58LDgy+P4YyFdOzDUecW4VfSij4=; b=wPwvHyYQxYtb74MKLfby5UvitAjNtHc8jLjL3Re5wJzBHxFqeZblzDmmNO/n+OIFO9 fZKnQPp2t57xSD/PgNbESHgFcsTwAnm16J3Vuff4AJAi02v1uljsi9a31ytkR/XscS3N EzJhNx7mOfRbkw1x/nTGGfvRCX39O+V7rhNN6MzQjPRVsBHZtrKgyFP8NqkaOecpbcOa Ctbx/0+GhIpueIl34x+H/lnEjw/5i4uuCTMEIW5zEaqhAh+6QbTJs0PXtxMbphXzvwg6 5JWpLUCBB3WuDRx5y4K90QmxyPKTqlpqjpm8nVJm3z4LVdHz063S+8iV/BU9u22tkxqy EWIg== X-Gm-Message-State: AOJu0YytQ3P+mP23+m1fRZ3DWfZ7TAfN3yq/pgZwDcUYXHq/PMRu2Iol daM5rB8X2z+JOh7n/ZXldmmzbrNyhxMK/HkCb32IWDW19NVkpcBZ2DYB75nLCuKF+xwEhgsfEi0 J9QHgN7nR+jK19fZAAR/efBQQRBd3o+liS/WNnFyrmBbbIllH1MbY5E/EQPzUHV+tyFHr8J9oe4 KBiOltkIvO/d8yL3y4JDfJ/6bR7ZZgUFhfNZneHzk= X-Received: by 2002:a05:600c:3c82:b0:42b:b016:94a3 with SMTP id 5b1f17b1804b1-42c88108590mr28688995e9.31.1725374193855; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/O9vLG/DaZDdweql9eKxQYtNgj4fEjuAeFoku3kg1Rvuibmovxu4HSeYE0UkPLFY7NHIjfg== X-Received: by 2002:a05:600c:3c82:b0:42b:b016:94a3 with SMTP id 5b1f17b1804b1-42c88108590mr28688625e9.31.1725374193039; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 7/8] network: Separate cleanup from networkRemoveInactive Date: Tue, 3 Sep 2024 16:36:26 +0200 Message-ID: <989159e664ff666b36feb519a5db6f673c74a30f.1725373964.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JZPSEKVXGJTQ5NKRZHNBRH4NELFFMKRM X-Message-ID-Hash: JZPSEKVXGJTQ5NKRZHNBRH4NELFFMKRM X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374338427116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The new function (networkCleanupInactive) can be called from an iterator over the list of networks without the risk of deadlock. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 3ef3444da241..0e8057e24aed 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -325,10 +325,10 @@ networkDnsmasqConfigFileName(virNetworkDriverConfig *= cfg, } =20 =20 -/* do needed cleanup steps and remove the network from the list */ +/* do needed cleanup steps */ static int -networkRemoveInactive(virNetworkDriverState *driver, - virNetworkObj *obj) +networkCleanupInactive(virNetworkDriverState *driver, + virNetworkObj *obj) { g_autoptr(virNetworkDriverConfig) cfg =3D virNetworkDriverGetConfig(dr= iver); g_autofree char *leasefile =3D NULL; @@ -372,6 +372,18 @@ networkRemoveInactive(virNetworkDriverState *driver, /* remove status file */ unlink(statusfile); =20 + return 0; +} + + +/* do needed cleanup steps and remove the network from the list */ +static int +networkRemoveInactive(virNetworkDriverState *driver, + virNetworkObj *obj) +{ + if (networkCleanupInactive(driver, obj) < 0) + return -1; + /* remove the network definition */ virNetworkObjRemoveInactive(driver->networks, obj); =20 --=20 2.46.0 From nobody Thu Dec 26 23:04:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) 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 1725374352849161.38083779709928; Tue, 3 Sep 2024 07:39:12 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C560612A0; Tue, 3 Sep 2024 10:39:11 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 96FA51472; Tue, 3 Sep 2024 10:36:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 37F33D8F; Tue, 3 Sep 2024 10:36:37 -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 C38E2BD7 for ; Tue, 3 Sep 2024 10:36:36 -0400 (EDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-370-tOmVwBHwO5Gucjf_hQRu9A-1; Tue, 03 Sep 2024 10:36:35 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42bbe70c1c2so36996735e9.1 for ; Tue, 03 Sep 2024 07:36:34 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bacaac810sm193253495e9.33.2024.09.03.07.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 07:36:32 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 6ED071FC90C1 for ; Tue, 03 Sep 2024 16:36:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725374196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=54FdrQkbmxI35/uwgmqhM3SeRSA5EmNSL49rhcT/lQk=; b=RSQs/WS2lLoEnp2Lby4h3iyXQLoeJbFx9PJi9dK98/Vis6rYGvl3Cpb8X270X24lXjdefQ YBVcQBtxnAs6a7JN0XFyVvDXD3SoXX1yxn229SXelW+8vTl4weZM4S2gFDeKOuc0Q73o6J wUIEAjdlGw/wlAoSCqZJh8PtZJH4/Dg= X-MC-Unique: tOmVwBHwO5Gucjf_hQRu9A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725374194; x=1725978994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=54FdrQkbmxI35/uwgmqhM3SeRSA5EmNSL49rhcT/lQk=; b=fv0RCBb11WgfTSyIWfMgNKBXKoHUjsVvaXfnFaQXLzYiz1bF2C4cLfOk5kgF2PR4qq XE9jIbgxfrk+IVAh34SugUlzJlNPH14zBLPPrWcUwsg9cBhWGjqdI+rHPRYx2EaYsP1Q jBKqt9GXYx8gqQx/JrYwpqOTRdnIVDEK7cNWgYpkpl+pNKuO0bqzsMh2ptp0V4+MOj1g 2qKUv32kmZCunnbRwRVuiWaafx396T/o263afjKw2yj2Xf8sE65syR4quCQYCrzxFX3T Fd6ZwAB/SrhPbu3b6srb7wUzONzpqwq7uJuNe8h4oEodUQClEkY/gRR5TA/448zctCeS WHYg== X-Gm-Message-State: AOJu0Yw82DzTZj/a+ML0yXwLjQnlaG8vZf3nbhcw/vpVHA1Q9m+AEL1v BSXmEUuXQkNNEISMmtaUuneNYu9Dbew7QN9epsSo4FA0OdgyhJaaXRBQgG5UnBuMAQl8vpWwXLX kdBdhJ4LxWFjBFnN1/ZvWg6V8/dMulLu2cLY+Wtqp6B7h4CEoO2UrVqkjaYpWLpXBauDCwfTU0b KNS8LGvd8thgCIrrIoOXnyIoq5NsrD+deLQ2GslPo= X-Received: by 2002:a05:600c:3145:b0:426:593c:9361 with SMTP id 5b1f17b1804b1-42bb27a9c67mr120466165e9.26.1725374193803; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEe69DRNyNmPkfAnetTeFsZsYxKgw1MVpjvyPaQlxEK5qXaS3bGnXURsTpLQCMdR5FXhz6MSg== X-Received: by 2002:a05:600c:3145:b0:426:593c:9361 with SMTP id 5b1f17b1804b1-42bb27a9c67mr120465975e9.26.1725374193210; Tue, 03 Sep 2024 07:36:33 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 8/8] network: Clean up after disappeared transient inactive networks Date: Tue, 3 Sep 2024 16:36:27 +0200 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MPZHKMCKNXEGCQQWKQTZ5UOSVXLOXVGK X-Message-ID-Hash: MPZHKMCKNXEGCQQWKQTZ5UOSVXLOXVGK X-MailFrom: mkletzan@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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725374354497116600 Content-Type: text/plain; charset="utf-8"; x-default="true" If a network disappeared the daemon should not only remove it from the list of networks, but also do a proper cleanup. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- src/network/bridge_driver.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 0e8057e24aed..0ba62d986ff4 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -533,6 +533,23 @@ networkUpdateState(virNetworkObj *obj, } =20 =20 +static int +networkCleanupTransientInactive(virNetworkObj *obj, + void *opaque) +{ + virNetworkDriverState *driver =3D opaque; + + if (!virNetworkObjIsActive(obj) && + !virNetworkObjIsPersistent(obj)) { + /* We can only do a cleanup here so that this can be called from an + * iterator over the networks */ + networkCleanupInactive(driver, obj); + } + + return 0; +} + + static int networkAutostartConfig(virNetworkObj *obj, void *opaque) @@ -659,6 +676,11 @@ networkStateInitialize(bool privileged, virNetworkObjListForEach(network_driver->networks, networkUpdateState, network_driver); + /* Before removing inactive transient networks from the list make sure= we + * clean up after them as well */ + virNetworkObjListForEach(network_driver->networks, + networkCleanupTransientInactive, + network_driver); virNetworkObjListPrune(network_driver->networks, VIR_CONNECT_LIST_NETWORKS_INACTIVE | VIR_CONNECT_LIST_NETWORKS_TRANSIENT); --=20 2.46.0