[pve-devel] [PATCH v4 ha-manager 1/5] Add update_service_config to the HA environment interface and simulation

Fabian Ebner f.ebner at proxmox.com
Thu Oct 10 12:25:05 CEST 2019


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/PVE/HA/Env.pm          |  6 ++++++
 src/PVE/HA/Env/PVE2.pm     |  6 ++++++
 src/PVE/HA/Sim/Env.pm      |  6 ++++++
 src/PVE/HA/Sim/Hardware.pm | 14 ++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/src/PVE/HA/Env.pm b/src/PVE/HA/Env.pm
index bb37486..ac569a9 100644
--- a/src/PVE/HA/Env.pm
+++ b/src/PVE/HA/Env.pm
@@ -87,6 +87,12 @@ sub read_service_config {
     return $self->{plug}->read_service_config();
 }
 
+sub update_service_config {
+    my ($self, $sid, $param) = @_;
+
+    return $self->{plug}->update_service_config($sid, $param);
+}
+
 sub parse_sid {
     my ($self, $sid) = @_;
 
diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index 796acd9..83145dc 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -120,6 +120,12 @@ sub read_service_config {
     return PVE::HA::Config::read_and_check_resources_config();
 }
 
+sub update_service_config {
+    my ($self, $sid, $param) = @_;
+
+    return PVE::HA::Config::update_resources_config($sid, $param);
+}
+
 sub parse_sid {
     my ($self, $sid) = @_;
 
diff --git a/src/PVE/HA/Sim/Env.pm b/src/PVE/HA/Sim/Env.pm
index 22e13e6..b286708 100644
--- a/src/PVE/HA/Sim/Env.pm
+++ b/src/PVE/HA/Sim/Env.pm
@@ -203,6 +203,12 @@ sub read_service_config {
     return $self->{hardware}->read_service_config();
 }
 
+sub update_service_config {
+    my ($self, $sid, $param) = @_;
+
+    return $self->{hardware}->update_service_config($sid, $param);
+}
+
 sub parse_sid {
     my ($self, $sid) = @_;
 
diff --git a/src/PVE/HA/Sim/Hardware.pm b/src/PVE/HA/Sim/Hardware.pm
index 9c0ad05..3cdc85b 100644
--- a/src/PVE/HA/Sim/Hardware.pm
+++ b/src/PVE/HA/Sim/Hardware.pm
@@ -109,6 +109,20 @@ sub read_service_config {
     return $conf;
 }
 
+sub update_service_config {
+    my ($self, $sid, $param) = @_;
+
+    my $conf = $self->read_service_config();
+
+    my $sconf = $conf->{$sid} || die "no such resource '$sid'\n";
+
+    foreach my $k (%$param) {
+	$sconf->{$k} = $param->{$k};
+    }
+
+    $self->write_service_config($conf);
+}
+
 sub write_service_config {
     my ($self, $conf) = @_;
 
-- 
2.20.1





More information about the pve-devel mailing list