Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=8900e3ed1... Commit: 8900e3ed1446a8b882cc6eed7fd3595b0f4d3ffb Parent: d6504496b019dcd6bd066dd398b898b87d4ddd49 Author: Marek 'marx' Grac mgrac@redhat.com AuthorDate: Fri May 31 10:15:44 2013 +0200 Committer: Marek 'marx' Grac mgrac@redhat.com CommitterDate: Fri May 31 10:15:44 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 | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl index f596c14..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,7 +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 { @@ -827,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) {
cluster-commits@lists.stg.fedorahosted.org