[pve-devel] [PATCH v2 ha-manager 08/15] env: datacenter config: include crs (cluster-resource-scheduling) setting
Fiona Ebner
f.ebner at proxmox.com
Thu Nov 17 15:00:09 CET 2022
Suggested-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
Changes from v1:
* Extend existing method rather than introducing a new one.
src/PVE/HA/Env/PVE2.pm | 10 +++++-----
src/PVE/HA/LRM.pm | 4 ++--
src/PVE/HA/Sim/Env.pm | 5 ++++-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index d2c46e8..f6ebfeb 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -456,12 +456,12 @@ sub get_datacenter_settings {
my ($self) = @_;
my $datacenterconfig = eval { cfs_read_file('datacenter.cfg') };
- if (my $err = $@) {
- $self->log('err', "unable to get HA settings from datacenter.cfg - $err");
- return {};
- }
+ $self->log('err', "unable to get HA settings from datacenter.cfg - $@") if $@;
- return $datacenterconfig->{ha};
+ return {
+ ha => $datacenterconfig->{ha} // {},
+ crs => $datacenterconfig->{crs} // {},
+ };
}
sub get_static_node_stats {
diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index 7750f4d..5d2fa2c 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -59,8 +59,8 @@ sub shutdown_request {
my ($shutdown, $reboot) = $haenv->is_node_shutdown();
- my $dc_ha_cfg = $haenv->get_datacenter_settings();
- my $shutdown_policy = $dc_ha_cfg->{shutdown_policy} // 'conditional';
+ my $dc_cfg = $haenv->get_datacenter_settings();
+ my $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'");
diff --git a/src/PVE/HA/Sim/Env.pm b/src/PVE/HA/Sim/Env.pm
index 6c47030..c6ea73c 100644
--- a/src/PVE/HA/Sim/Env.pm
+++ b/src/PVE/HA/Sim/Env.pm
@@ -430,7 +430,10 @@ sub get_datacenter_settings {
my $datacenterconfig = $self->{hardware}->read_datacenter_conf();
- return $datacenterconfig->{ha};
+ return {
+ ha => $datacenterconfig->{ha} // {},
+ crs => $datacenterconfig->{crs} // {},
+ };
}
sub get_static_node_stats {
--
2.30.2
More information about the pve-devel
mailing list