[pve-devel] [PATCH v2 ha-manager 3/7] pve2 env: get shutdown policy override set by node's shutdown API endpoint

Fiona Ebner f.ebner at proxmox.com
Tue Jun 20 12:54:32 CEST 2023


Signed-off-by: Fiona Ebner <f.ebner at 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






More information about the pve-devel mailing list