Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 893b4547bb5f5eb61d2f3af4281e5a38 > files > 144

cman-2.0.115-96.el5_8.1.src.rpm

From 6402cd9db57ed2d2052132cf59f6e2450be3d964 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Mon, 2 Aug 2010 16:01:24 +0200
Subject: [PATCH] fencing: Method to cause one node to delay fencing - drac, egenera

Manual pages were updated too as they are not generated automatically
for these agents.

Resolves: rhbz#613064
---
 fence/agents/drac/fence_drac.pl       |   13 ++++++++++++-
 fence/agents/egenera/fence_egenera.pl |   10 +++++++++-
 fence/man/fence_drac.8                |   12 ++++++++++++
 fence/man/fence_egenera.8             |    6 ++++++
 4 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/fence/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
index e6dfbd9..8aca16b 100755
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -89,6 +89,7 @@ sub usage
 	print "  -o <string>      Action: reboot (default), off or on\n";
 	print "  -p <string>      Login password\n";
 	print "  -S <path>        Script to run to retrieve password\n";
+	print "  -f <seconds>     Wait X seconds before fencing is started\n";
 	print "  -q               quiet mode\n";
 	print "  -V               version\n";
 	print "\n";
@@ -99,6 +100,7 @@ sub usage
 	print "  login  = \"name\"        Login name\n";
 	print "  passwd = \"string\"      Login password\n";
 	print "  passwd_script = \"path\" Script to run to retrieve password\n";
+	print "  delay = \"seconds\"      Wait X seconds before fencing is started\n";
 
 	exit 0;
 }
@@ -449,6 +451,10 @@ sub telnet_error
 #
 sub do_action
 {
+	if (($action =~ /^off$/i) || ($action =~ /^reboot$/i)) {
+		sleep ($delay) if defined($delay);
+	}
+
 	get_power_status;
 	my $status = $_;
 
@@ -579,6 +585,10 @@ sub get_options_stdin
 		{
 			$cmd_prompt = $val;
 		} 
+		elsif ($name eq "delay")
+		{
+			$delay = $val;
+		}
 	}
 }
 
@@ -589,7 +599,7 @@ sub get_options_stdin
 # Check parameters
 #
 if (@ARGV > 0) {
-	getopts("a:c:d:D:hl:m:o:p:S:qVv") || fail_usage ;
+	getopts("a:c:d:D:hl:m:o:p:S:qVvf:") || fail_usage ;
 	
 	usage if defined $opt_h;
 	version if defined $opt_V;
@@ -606,6 +616,7 @@ if (@ARGV > 0) {
 	$login = $opt_l;
 
 	$modulename = $opt_m if defined $opt_m;
+	$delay = $opt_f if defined $opt_f;
 
 	if (defined $opt_S) {
 		$pwd_script_out = `$opt_S`;
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
index ce191cd..e863c90 100755
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -55,6 +55,7 @@ sub usage
 	print "  -o <string>      Action: reboot (default), off, on or status\n";
 	print "  -p <string>      pserver\n";
 	print "  -u <string>      username (default=root)\n";
+	print "  -f <seconds>     Wait X seconds before fencing is started\n";
 	print "  -q               quiet mode\n";
 	print "  -V               version\n";
 	
@@ -88,7 +89,7 @@ sub version
 
 if (@ARGV > 0) 
 {
-	getopts("c:hl:o:p:u:qV") || fail_usage ;
+	getopts("c:hl:o:p:u:qVf:") || fail_usage ;
 
 	usage if defined $opt_h;
 	version if defined $opt_V;
@@ -100,6 +101,7 @@ if (@ARGV > 0)
 	$pserv  = $opt_p if defined $opt_p;
 	$action = $opt_o if defined $opt_o;
 	$user   = $opt_u if defined $opt_u;
+	$delay  = $opt_f if defined $opt_f;
 } 
 else 
 {
@@ -177,6 +179,10 @@ sub get_options_stdin
 		{
 			$user = $val;
 		}
+		elsif ($name eq "delay" )
+		{
+			$delay = $val;
+		}
 	}
 }
 
@@ -396,6 +402,7 @@ elsif (/^pblade$/i)
 }
 elsif (/^off$/i)
 {
+	sleep ($delay) if defined($delay);
 	if (pserver_shutdown==0)
 	{
 		print "success: $lpan/$pserv has been shutdown\n" 
@@ -422,6 +429,7 @@ elsif (/^on$/i)
 }
 elsif (/^reboot$/i)
 {
+	sleep ($delay) if defined($delay);
 	if (pserver_shutdown!=0)
 	{
 		fail "failed to shutdown $lpan/$pserv";
diff --git a/fence/man/fence_drac.8 b/fence/man/fence_drac.8
index 40e3d6a..0e6c898 100644
--- a/fence/man/fence_drac.8
+++ b/fence/man/fence_drac.8
@@ -60,6 +60,12 @@ The action required.  reboot (default), off, on or status.
 \fB-p\fP \fIpassword\fR
 Password for login.
 .TP
+\fB-S\fP \fIpath\fR
+Full path to an executable to generate the password for login.
+.TP
+\fB-f\fP \fIseconds\fR
+Wait X seconds before fencing is started
+.TP
 \fB-V\fP
 Print out a version message, then exit.
 
@@ -92,6 +98,12 @@ The module name of the blade when using DRAC/MC firmware.
 \fIpasswd = < param >\fR
 Password for login.
 .TP
+\fIpasswd_script = < param >\fR
+Full path to an executable to generate the password for login.
+.TP
+\fIdelay = < param >\fR
+Wait X seconds before fencing is started
+.TP
 
 .SH SEE ALSO
 fence(8), fence_node(8)
diff --git a/fence/man/fence_egenera.8 b/fence/man/fence_egenera.8
index 6b3dd0d..44ac4f5 100644
--- a/fence/man/fence_egenera.8
+++ b/fence/man/fence_egenera.8
@@ -46,6 +46,9 @@ The action required.  reboot (default), off, on or status.
 \fB-p\fP \fIpserver\fR
 the pserver to operate on
 .TP
+\fB-f\fP \fIseconds\fR
+Wait X seconds before fencing is started
+.TP
 \fB-q\fP
 quite mode.  supress output.
 .TP
@@ -72,6 +75,9 @@ The pserver to operate on
 .TP
 \fIesh = < param >\fR
 The path to the esh command on the cserver (default is /opt/panmgr/bin/esh)
+.TP
+\fIdelay = < param >\fR
+Wait X seconds before fencing is started
 
 .SH SEE ALSO
 fence(8), fence_node(8), ssh(8)
-- 
1.6.0.6