public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 ha-manager 3/7] pve2 env: get shutdown policy override set by node's shutdown API endpoint
Date: Tue, 20 Jun 2023 12:54:32 +0200	[thread overview]
Message-ID: <20230620105438.121605-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230620105438.121605-1-f.ebner@proxmox.com>

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

No changes in v2.

 src/PVE/HA/Env/PVE2.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index f6ebfeb..6a75bd4 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -458,9 +458,17 @@ sub get_datacenter_settings {
     my $datacenterconfig = eval { cfs_read_file('datacenter.cfg') };
     $self->log('err', "unable to get HA settings from datacenter.cfg - $@") if $@;
 
+    my $sp_override_fn = '/run/pve-ha-lrm/shutdown-policy.local-override';
+    my $shutdown_policy_override = eval { PVE::Tools::file_read_firstline($sp_override_fn); };
+    $self->log('warning', "error reading shutdown policy override from $sp_override_fn - $@") if $@;
+
+    my $overrides = {};
+    $overrides->{ha}->{shutdown_policy} = $shutdown_policy_override if $shutdown_policy_override;
+
     return {
 	ha => $datacenterconfig->{ha} // {},
 	crs => $datacenterconfig->{crs} // {},
+	'local-overrides' => $overrides,
     };
 }
 
-- 
2.39.2





  parent reply	other threads:[~2023-06-20 10:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 10:54 [pve-devel] [PATCH-SERIES v2 (ha-)manager] allow node HA shutdown policy override Fiona Ebner
2023-06-20 10:54 ` [pve-devel] [PATCH v2 ha-manager 1/7] lrm service: add runtime directory Fiona Ebner
2023-06-20 10:54 ` [pve-devel] [RFC v2 ha-manager 2/7] lrm service: move PID file to service's " Fiona Ebner
2023-06-20 10:54 ` Fiona Ebner [this message]
2023-06-20 10:54 ` [pve-devel] [PATCH v2 ha-manager 4/7] lrm: honor shutdown policy override set by node's shutdown API endpoint Fiona Ebner
2023-06-20 10:54 ` [pve-devel] [RFC v2 ha-manager 5/7] pve2 env: validate shutdown policy from override file Fiona Ebner
2023-06-20 10:54 ` [pve-devel] [PATCH v2 ha-manager 6/7] sim env: add support for datacenter config overrides Fiona Ebner
2023-06-20 10:54 ` [pve-devel] [PATCH v2 ha-manager 7/7] tests: add test for shutdown policy override Fiona Ebner
2023-06-20 10:54 ` [pve-devel] [PATCH v2 manager 1/2] api: nodes: allow setting HA shutdown policy during shutdown/reboot Fiona Ebner
2023-06-20 10:54 ` [pve-devel] [PATCH v2 manager 2/2] ui: allow specifying shutdown policy during node shutdown/reboot Fiona Ebner

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=20230620105438.121605-4-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.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