]>
git.proxmox.com Git - pve-ha-manager.git/blob - PVE/HA/Env.pm
9 # abstract out the cluster environment for a single node
12 my ($this, $baseclass, $node, @args) = @_;
14 my $class = ref($this) || $this;
16 my $plug = $baseclass->new($node, @args);
18 my $self = bless { plug
=> $plug }, $class;
26 return $self->{plug
}->nodename();
29 sub read_local_status
{
32 return $self->{plug
}->read_local_status();
35 sub write_local_status
{
36 my ($self, $status) = @_;
38 return $self->{plug
}->write_local_status($status);
41 # manager status is stored on cluster, protected by ha_manager_lock
42 sub read_manager_status
{
45 return $self->{plug
}->read_manager_status();
48 sub write_manager_status
{
49 my ($self, $status_obj) = @_;
51 return $self->{plug
}->write_manager_status($status_obj);
54 # we use this to enable/disbale ha
55 sub manager_status_exists
{
58 return $self->{plug
}->manager_status_exists();
61 sub read_service_config
{
64 return $self->{plug
}->read_service_config();
67 # this should return a hash containing info
68 # what nodes are members and online.
72 return $self->{plug
}->get_node_info();
76 my ($self, $level, @args) = @_;
78 return $self->{plug
}->log($level, @args);
81 # aquire a cluster wide manager lock
82 sub get_ha_manager_lock
{
85 return $self->{plug
}->get_ha_manager_lock();
88 # aquire a cluster wide node agent lock
89 sub get_ha_agent_lock
{
92 return $self->{plug
}->get_ha_agent_lock();
95 sub test_ha_agent_lock
{
96 my ($self, $node) = @_;
98 return $self->{plug
}->test_ha_agent_lock($node);
101 # return true when cluster is quorate
105 return $self->{plug
}->quorate();
108 # return current time
109 # overwrite that if you want to simulate
113 return $self->{plug
}->get_time();
117 my ($self, $delay) = @_;
119 return $self->{plug
}->sleep($delay);
123 my ($self, $end_time) = @_;
125 return $self->{plug
}->sleep_until($end_time);
128 sub loop_start_hook
{
129 my ($self, @args) = @_;
131 return $self->{plug
}->loop_start_hook(@args);
135 my ($self, @args) = @_;
137 return $self->{plug
}->loop_end_hook(@args);
143 return $self->{plug
}->watchdog_open();
146 sub watchdog_update
{
147 my ($self, $wfh) = @_;
149 return $self->{plug
}->watchdog_update($wfh);
153 my ($self, $wfh) = @_;
155 return $self->{plug
}->watchdog_close($wfh);