From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 66E3C1FF0B4 for ; Fri, 27 Nov 2026 16:09:11 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2A5B12170C; Fri, 27 Nov 2026 16:09:09 +0100 (CET) Date: Fri, 27 Nov 2026 16:09:03 +0100 From: Arthur Bied-Charreton To: Stefan Hanreich Subject: Re: [PATCH pve-firewall v2 04/12] fix #5759: firewall: do not remove chains when host is shutting down Message-ID: <24whrzvgynirza277qf3zh7r6hnyfenxzrah3j2yj24v7xvobi@rn6pqvuevoyo> References: <20261001122625.348730-1-a.bied-charreton@proxmox.com> <20261001122625.348730-5-a.bied-charreton@proxmox.com> <179206832307.200960.16160107779714540627.b4-review@b4> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <179206832307.200960.16160107779714540627.b4-review@b4> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795792144583 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.538 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: YCJOQCK4ZKWNYK5TWR42MJ7GI37AOHSV X-Message-ID-Hash: YCJOQCK4ZKWNYK5TWR42MJ7GI37AOHSV X-MailFrom: a.bied-charreton@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: [snip] > > > > +=head3 is_host_shutdown() > > + > > +Query C, returning C<1> if the system's running state is C, > > +C<0> otherwise. > > + > > +Note that C<1> is also returned if the running state of the system could not be determined, in order > > +to fail closed. > > + > > +=cut > > + > > +sub is_host_shutdown { > > + my $state = undef; > > + > > + PVE::Tools::run_command( > > + ['systemctl', 'is-system-running'], > > + outfunc => sub { $state = PVE::Tools::trim(shift) }, > > + noerr => 1, > > + ); > > While it is an alias, I think newer code should use the dedicated Cmd > module. ack > > Using eval instead of noerr should catch any general errors with > run_command and allow handling them instead of relying on $state. It'd > also give a better indication of *why* this failed and we can log it. > makes sense, will use eval and log errors, however for the record noerr is still required because `systemctl is-system-running` will exit with a non-zero code for any state that is not 'running' > -- > Stefan Hanreich -- Arthur Bied-Charreton