]>
git.proxmox.com Git - pve-ha-manager.git/blob - PVE/HA/Env.pm
9 # abstract out the cluster environment
12 my ($this, $statusdir, $nodename) = @_;
14 my $class = ref($this) || $this;
17 statusdir
=> $statusdir,
18 nodename
=> $nodename,
27 return $self->{nodename
};
30 sub read_local_status
{
33 return PVE
::Tools
::file_read_firstline
("$self->{statusdir}/local_status");
36 sub write_local_status
{
37 my ($self, $status) = @_;
39 PVE
::Tools
::file_set_contents
("$self->{statusdir}/local_status", $status);
42 # manager status is stored on cluster, protected by ha_manager_lock
43 sub read_manager_status
{
51 sub write_manager_status
{
52 my ($self, $status_obj) = @_;
57 # we use this to enable/disbale ha
58 sub manager_status_exists
{
66 # this should return a hash containing info
67 # what nodes are members and online.
73 # return { node1 => { online => 1, join_time => X }, node2 => ... }
77 my ($self, $level, $msg) = @_;
82 # aquire a cluster wide lock
83 sub get_ha_manager_lock
{
89 # return true when cluster is quorate
97 # overwrite that if you want to simulate
105 my ($self, $delay) = @_;
110 sub loop_start_hook
{