[pve-devel] [RFC pve-ha-manager 4/5] allow use of external fencing devices

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Nov 11 12:39:04 CET 2015


A node now can be fenced with the use of external hardware fence
devices. This is currently set hard-coded to true by the previous
patch (sorry) and will be an option in the datacenter.cfg (or
somewhere else?).

The CRM bails out in case of an lost manager lock event.

The manager class (=CRM) processes the fencing jobs on each manage
call.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/CRM.pm        |  4 ++++
 src/PVE/HA/Manager.pm    |  4 ++++
 src/PVE/HA/NodeStatus.pm | 11 ++++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/CRM.pm b/src/PVE/HA/CRM.pm
index 4196bba..f589065 100644
--- a/src/PVE/HA/CRM.pm
+++ b/src/PVE/HA/CRM.pm
@@ -8,6 +8,7 @@ use warnings;
 use PVE::SafeSyslog;
 use PVE::Tools;
 use PVE::HA::Tools;
+use PVE::HA::Fence;
 
 use PVE::HA::Manager;
 
@@ -227,6 +228,9 @@ sub do_one_iteration {
 	    delete $self->{ha_manager_wd};
 	}
 
+	# reset pending fence jobs and node states
+	$haenv->fence_agent('bailout');
+
 	return 0 if $self->{shutdown_request};
 
 	$self->set_local_status({ state => 'wait_for_quorum' });
diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index 6a98cd3..7fa5ea2 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -8,6 +8,7 @@ use Data::Dumper;
 use PVE::Tools;
 use PVE::HA::Tools ':exit_codes';
 use PVE::HA::NodeStatus;
+use PVE::HA::Fence;
 
 my $fence_delay = 60;
 
@@ -384,6 +385,9 @@ sub manage {
 	    &$change_service_state($self, $sid, 'stopped');	    
 	}
 
+	# pick up and evaluate fence jobs
+	PVE::HA::Fence::proccess_fencing();
+
 	last if !$repeat;
     }
 
diff --git a/src/PVE/HA/NodeStatus.pm b/src/PVE/HA/NodeStatus.pm
index eb174cb..9a045de 100644
--- a/src/PVE/HA/NodeStatus.pm
+++ b/src/PVE/HA/NodeStatus.pm
@@ -2,6 +2,7 @@ package PVE::HA::NodeStatus;
 
 use strict;
 use warnings;
+use PVE::HA::Fence;
 
 use Data::Dumper;
 
@@ -177,11 +178,19 @@ sub fence_node {
 	&$set_node_state($self, $node, 'fence');
     }
 
-    my $success = $haenv->get_ha_agent_lock($node);
+    my $success;
+
+    eval {
+	$success = $haenv->fence_agent('fence', $node);
+    };
+    if (my $err = $@) {
+	$haenv->log("error", "Fence error: $err");
+    }
 
     if ($success) {
 	$haenv->log("info", "fencing: acknowleged - got agent lock for node '$node'");
 	&$set_node_state($self, $node, 'unknown');
+	PVE::HA::Fence::reset($node);
     }
 
     return $success;
-- 
2.1.4





More information about the pve-devel mailing list