cluster: STABLE3 - fencing: Method to cause one node to delay fencing - drac, egenera

Marek Grác marx at fedoraproject.org
Mon Aug 2 13:56:27 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=91450b013aefe5374c330b83b515da11f5daf338
Commit:        91450b013aefe5374c330b83b515da11f5daf338
Parent:        59222e02a1f69cbd8956f7ac39b515a8c038a15d
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Mon Aug 2 14:31:59 2010 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Aug 2 15:52:24 2010 +0200

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#614046
---
 fence/agents/drac/fence_drac.8        |    6 ++++++
 fence/agents/drac/fence_drac.pl       |   13 ++++++++++++-
 fence/agents/egenera/fence_egenera.8  |    6 ++++++
 fence/agents/egenera/fence_egenera.pl |   10 +++++++++-
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/fence/agents/drac/fence_drac.8 b/fence/agents/drac/fence_drac.8
index 3e302d9..3660c5a 100644
--- a/fence/agents/drac/fence_drac.8
+++ b/fence/agents/drac/fence_drac.8
@@ -59,6 +59,9 @@ Password for login.
 \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.
 
@@ -94,6 +97,9 @@ Password for login.
 \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/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
index 55d512d..e28ed98 100644
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -77,6 +77,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";
@@ -87,6 +88,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;
 }
@@ -437,6 +439,10 @@ sub telnet_error
 #
 sub do_action
 {
+	if (($action =~ /^off$/i) || ($action =~ /^reboot$/i)) {
+		sleep ($delay) if defined($delay);
+	}
+
 	get_power_status;
 	my $status = $_;
 
@@ -567,6 +573,10 @@ sub get_options_stdin
 		{
 			$cmd_prompt = $val;
 		} 
+		elsif ($name eq "delay")
+		{
+			$delay = $val;
+		}
 	}
 }
 
@@ -577,7 +587,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;
@@ -594,6 +604,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.8 b/fence/agents/egenera/fence_egenera.8
index 7e907cd..1111b1b 100644
--- a/fence/agents/egenera/fence_egenera.8
+++ b/fence/agents/egenera/fence_egenera.8
@@ -41,6 +41,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.  suppress output.
 .TP
@@ -67,6 +70,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)
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
index 8e6aa1b..f09ff32 100644
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -42,6 +42,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";
 	
@@ -75,7 +76,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;
@@ -87,6 +88,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 
 {
@@ -164,6 +166,10 @@ sub get_options_stdin
 		{
 			$user = $val;
 		}
+		elsif ($name eq "delay" )
+		{
+			$delay = $val;
+		}
 	}
 }
 
@@ -383,6 +389,7 @@ elsif (/^pblade$/i)
 }
 elsif (/^off$/i)
 {
+	sleep ($delay) if defined($delay);
 	if (pserver_shutdown==0)
 	{
 		print "success: $lpan/$pserv has been shutdown\n" 
@@ -409,6 +416,7 @@ elsif (/^on$/i)
 }
 elsif (/^reboot$/i)
 {
+	sleep ($delay) if defined($delay);
 	if (pserver_shutdown!=0)
 	{
 		fail "failed to shutdown $lpan/$pserv";


More information about the cluster-commits mailing list