From nobody Wed Jan 15 04:22:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1682911279; cv=none; d=zohomail.com; s=zohoarc; b=A6kLjf+KiaXp6pW8CcciYmec3XgxcctEdHGIJQ6/7khum2EdrKD6GrTEw8fAegUWkuiY6+ZWqbubgaj06P028aH2Db2R+DmzC/wbishbq8ZO2cqQOnPSNSU4mRBT37qXsOOl8HxWDp2QYtYzLQ+nAEhDKlkReA038CUvdrvaI5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682911279; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sxZqovJO/OmO/6iy30gpnwOnUnrgYaw6TUViy0XClZc=; b=gTguWXrpoMhMOMvgdxRTVd/jsNumFQIxQsYB3//gi+7ETTRkYVeLMWmxPaSEtIRSj3G73vtLdl+zNNQpoLdep3Ec5htwhaz6twkdKnBDqJCvVoA094fTLBKY04na5Oejjbic6G8iLxNOcdxYPl3qhoYP29TOfSF1LngTDGMkj7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1682911279673618.7573474427676; Sun, 30 Apr 2023 20:21:19 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-282-koLUlo4gOHy2lqfvnmZEGA-1; Sun, 30 Apr 2023 23:20:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9788788F47E; Mon, 1 May 2023 03:20:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81F4440C2009; Mon, 1 May 2023 03:20:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 63E33194F248; Mon, 1 May 2023 03:20:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E42981946A62 for ; Mon, 1 May 2023 03:20:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 512A3463ECD; Mon, 1 May 2023 03:19:48 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.8.105]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36B58475026 for ; Mon, 1 May 2023 03:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682911278; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=sxZqovJO/OmO/6iy30gpnwOnUnrgYaw6TUViy0XClZc=; b=M9RumHNvuq2bOLxURLWi3dbmpUWXToE01uLNx5rAoNawrgxoUHT5t3WGsbyJSTu5hiMQsF rBRE/mu1AL1oqZUoThiNeyT7R6SYQVMjjlloWHXj6M+yDHB22w5o+GxbfC1jdf4mcGi+X3 ztL1L1M95iDsM5Ns2rCWOuAD5MY7VGw= X-MC-Unique: koLUlo4gOHy2lqfvnmZEGA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 27/28] network: save network status when firewall rules are reloaded Date: Sun, 30 Apr 2023 23:19:42 -0400 Message-Id: <20230501031943.288145-28-laine@redhat.com> In-Reply-To: <20230501031943.288145-1-laine@redhat.com> References: <20230501031943.288145-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682911280245100011 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Laine Stump --- src/conf/virnetworkobj.c | 1 + src/network/bridge_driver.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index ae26f6fab1..ce39ab5250 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -846,6 +846,7 @@ virNetworkObjSaveStatus(const char *statusDir, int flags =3D 0; g_autofree char *xml =3D NULL; =20 + VIR_DEBUG("Writing network status to disk"); if (!(xml =3D virNetworkObjFormat(obj, xmlopt, flags))) return -1; =20 diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 9f876d7418..1b831f9a36 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1687,6 +1687,7 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj, g_autoptr(virNetworkDriverConfig) cfg =3D virNetworkDriverGetConfig(ne= tworkGetDriver()); VIR_LOCK_GUARD lock =3D virObjectLockGuard(obj); virNetworkDef *def =3D virNetworkObjGetDef(obj); + bool saveStatus =3D false; =20 if (virNetworkObjIsActive(obj)) { switch ((virNetworkForwardType) def->forward.type) { @@ -1702,6 +1703,7 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj, ignore_value(networkAddFirewallRules(def, virNetworkObjGetFwRemoval= Ptr(obj), cfg->firewallBackend)); + saveStatus =3D true; break; =20 case VIR_NETWORK_FORWARD_OPEN: @@ -1719,6 +1721,11 @@ networkReloadFirewallRulesHelper(virNetworkObj *obj, } } =20 + if (saveStatus) { + ignore_value(virNetworkObjSaveStatus(cfg->stateDir, obj, + network_driver->xmlopt)); + } + return 0; } =20 @@ -2336,7 +2343,6 @@ networkStartNetwork(virNetworkDriverState *driver, /* Persist the live configuration now that anything autogenerated * is setup. */ - VIR_DEBUG("Writing network status to disk"); if (virNetworkObjSaveStatus(cfg->stateDir, obj, network_driver->xmlopt) < 0) goto cleanup; --=20 2.39.2