[pve-devel] [PATCH pve-ha-manager 1/7] Sim/Hardware: move set_service_state to base class
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Dec 21 16:38:02 CET 2015
Move the set_service_state method from the Realtime Hardware class
(RTHardware) to it's base class as the TestHardware could also use
it.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/HA/Sim/Hardware.pm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/PVE/HA/Sim/Hardware.pm b/src/PVE/HA/Sim/Hardware.pm
index 24ef68b..8424853 100644
--- a/src/PVE/HA/Sim/Hardware.pm
+++ b/src/PVE/HA/Sim/Hardware.pm
@@ -114,6 +114,18 @@ sub write_service_config {
return PVE::HA::Tools::write_json_to_file($filename, $conf);
}
+sub set_service_state {
+ my ($self, $sid, $state) = @_;
+
+ my $conf = $self->read_service_config();
+ $conf->{$sid} || die "no such service '$sid'";
+
+ $conf->{$sid}->{state} = $state;
+ $self->write_service_config($conf);
+
+ return $conf;
+}
+
sub change_service_location {
my ($self, $sid, $current_node, $new_node) = @_;
--
2.1.4
More information about the pve-devel
mailing list