Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=2398c9...
Commit: 2398c9b5741eb5e5191afda535b27f781ac263a1
Parent: 6fbdb7961c36a8f0ca9e4a535795f5872f71a029
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri May 31 10:15:44 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Jun 27 11:11:54 2013 +0200
fence_scsi: Add "delay" option
Adding "delay" option to fence_scsi.
WARNING: we are using -H / delay= instead of "-f" as in fencing library because
-f is already used in fence_scsi.
Resolves: rhbz#912773
---
fence/agents/scsi/fence_scsi.pl | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 45cfe22..a447661 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -664,6 +664,9 @@ sub get_options_stdin ()
elsif ($opt eq "action") {
$opt_o = $arg;
}
+ elsif ($opt eq "delay") {
+ $opt_H = $arg;
+ }
}
}
@@ -677,6 +680,7 @@ sub print_usage ()
print " -a Use APTPL flag\n";
print " -d <devices> Devices to be used for action\n";
print " -f <logfile> File to write debug/error output\n";
+ print " -H <timeout> Wait X seconds before fencing is
started\n";
print " -h Usage\n";
print " -k <key> Key to be used for current action\n";
print " -n <nodename> Name of node to operate on\n";
@@ -723,6 +727,14 @@ sub print_metadata ()
"File to write error/debug messages" .
"</shortdesc>\n";
print "\t</parameter>\n";
+ print "\t</parameter>\n";
+ print "\t<parameter name=\"delay\" unique=\"0\"
required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-H\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Wait X seconds before fencing is started" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
print "\t<parameter name=\"key\" unique=\"0\"
required=\"0\">\n";
print "\t\t<getopt mixed=\"-k\"/>\n";
print "\t\t<content type=\"string\"/>\n";
@@ -759,8 +771,7 @@ sub print_metadata ()
################################################################################
if (@ARGV > 0) {
- getopts ("ad:f:hk:n:o:qV") or print_usage;
-
+ getopts ("ad:f:H:hk:n:o:qV") or print_usage;
print_usage if (defined $opt_h);
print_version if (defined $opt_V);
} else {
@@ -828,6 +839,12 @@ if (!defined $opt_o) {
$opt_o = "off";
}
+## Wait for defined period (-H / delay= )
+##
+if ((defined $opt_H) && ($opt_H =~ /^[0-9]+/)) {
+ sleep($opt_H);
+}
+
## determine the action to perform
##
if ($opt_o =~ /^on$/i) {