public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-firewall v2 04/12] fix #5759: firewall: do not remove chains when host is shutting down
Date: Fri, 27 Nov 2026 16:09:03 +0100	[thread overview]
Message-ID: <24whrzvgynirza277qf3zh7r6hnyfenxzrah3j2yj24v7xvobi@rn6pqvuevoyo> (raw)
In-Reply-To: <179206832307.200960.16160107779714540627.b4-review@b4>

[snip]
> >  
> > +=head3 is_host_shutdown()
> > +
> > +Query C<systemctl is-system-running>, returning C<1> if the system's running state is C<stopping>,
> > +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 <s.hanreich@proxmox.com>

-- 
Arthur Bied-Charreton




  reply	other threads:[~2026-11-27 15:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 12:26 [RFC firewall/manager/proxmox{,-firewall} v2 00/12] fix #5759: keep firewall rules up across boot and shutdown Arthur Bied-Charreton
2026-10-01 12:26 ` [PATCH pve-manager v2 01/12] network interface pinning: write new firewall config to local dir Arthur Bied-Charreton
2026-10-01 12:26 ` [PATCH pve-firewall v2 02/12] firewall: config: sort OPTIONS when serializing Arthur Bied-Charreton
2026-10-15 12:45   ` Stefan Hanreich
2026-10-01 12:26 ` [PATCH pve-firewall v2 03/12] firewall: dump configs locally after applying Arthur Bied-Charreton
2026-10-15 12:45   ` Stefan Hanreich
2026-10-01 12:26 ` [PATCH pve-firewall v2 04/12] fix #5759: firewall: do not remove chains when host is shutting down Arthur Bied-Charreton
2026-10-15 12:45   ` Stefan Hanreich
2026-11-27 15:09     ` Arthur Bied-Charreton [this message]
2026-10-01 12:26 ` [PATCH pve-firewall v2 05/12] firewall: add restore command Arthur Bied-Charreton
2026-10-15 12:45   ` Stefan Hanreich
2026-10-01 12:26 ` [PATCH pve-firewall v2 06/12] fix #5759: firewall: restore from dumped config before network-pre Arthur Bied-Charreton
2026-10-15 12:45   ` Stefan Hanreich
2026-10-01 12:26 ` [PATCH proxmox v2 07/12] systemd: systemctl: add is-system-running helper Arthur Bied-Charreton
2026-10-01 12:26 ` [PATCH proxmox-firewall v2 08/12] firewall: fix clippy warnings Arthur Bied-Charreton
2026-10-15 12:44   ` Stefan Hanreich
2026-10-01 12:26 ` [PATCH proxmox-firewall v2 09/12] fix #5759: firewall: do not clear rules on system shutdown Arthur Bied-Charreton
2026-10-01 12:26 ` [PATCH proxmox-firewall v2 10/12] firewall: dump config to local directory after apply Arthur Bied-Charreton
2026-10-15 12:44   ` Stefan Hanreich
2026-10-01 12:26 ` [PATCH proxmox-firewall v2 11/12] firewall: add restore command Arthur Bied-Charreton
2026-10-15 12:44   ` Stefan Hanreich
2026-10-01 12:26 ` [PATCH proxmox-firewall v2 12/12] fix #5759: firewall: restore from dumped config before network-pre Arthur Bied-Charreton
2026-10-15 12:45 ` [RFC firewall/manager/proxmox{,-firewall} v2 00/12] fix #5759: keep firewall rules up across boot and shutdown Stefan Hanreich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24whrzvgynirza277qf3zh7r6hnyfenxzrah3j2yj24v7xvobi@rn6pqvuevoyo \
    --to=a.bied-charreton@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal