[pve-devel] [PATCH ha-manager 4/7] lrm: honor shutdown policy override set by node's shutdown API endpoint

Fiona Ebner f.ebner at proxmox.com
Fri Jun 16 13:33:41 CEST 2023


The /nodes/<node>/status API endpoint in pve-manager allows to specify
the shutdown policy now. This change is required for it to have any
effect of course.

Being able to choose the shutdown policy on a per-node/per-shutdown
is more flexible and user-friendly.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/HA/LRM.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index b6ac0fe..b8b842f 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -60,7 +60,10 @@ sub shutdown_request {
     my ($shutdown, $reboot) = $haenv->is_node_shutdown();
 
     my $dc_cfg = $haenv->get_datacenter_settings();
-    my $shutdown_policy = $dc_cfg->{ha}->{shutdown_policy} // 'conditional';
+    my $dc_ha_overrides = $dc_cfg->{'local-overrides'}->{ha} // {};
+
+    my $shutdown_policy =
+	$dc_ha_overrides->{shutdown_policy} // $dc_cfg->{ha}->{shutdown_policy} // 'conditional';
 
     if ($shutdown) { # don't log this on service restart, only on node shutdown
 	$haenv->log('info', "got shutdown request with shutdown policy '$shutdown_policy'");
-- 
2.39.2






More information about the pve-devel mailing list