cluster: RHEL56 - fencing: Method to cause one node to delay fencing - drac, egenera
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 6402cd9db57ed2d2052132cf59f6e2450be3d964
Parent: 0b62fb0f9cc5c3c3ea13538fa21abcfd2b816244
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 2 16:01:24 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 16:01: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#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)
13 years, 9 months
cluster: RHEL56 - fencing: Method to cause one node to delay fencing - metadata
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 0b62fb0f9cc5c3c3ea13538fa21abcfd2b816244
Parent: 06499869a35807910749780c30e30a06893ceecb
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Jul 28 14:54:44 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 15:59:33 2010 +0200
fencing: Method to cause one node to delay fencing - metadata
Option was not correctly showed in metadata
Resolves: rhbz#613064
---
fence/agents/lib/fencing.py.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 427b201..43eafe2 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -71,6 +71,8 @@ all_opt = {
"getopt" : "f:",
"longopt" : "delay",
"help" : "--delay <seconds> Wait X seconds before fencing is started",
+ "required" : "0",
+ "shortdesc" : "Wait X seconds before fencing is started",
"default" : "0",
"order" : 200 },
"agent" : {
13 years, 9 months
cluster: RHEL56 - fencing: Method to cause one node to delay fencing
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 06499869a35807910749780c30e30a06893ceecb
Parent: 960b39695fab477e5b63b6aa16aa4d86d717233a
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 2 15:51:23 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 15:59:14 2010 +0200
fencing: Method to cause one node to delay fencing
Patch to fencing library
Resolves: rhbz#613064
---
fence/agents/lib/fencing.py.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index fd828a3..427b201 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -67,6 +67,12 @@ all_opt = {
"required" : "0",
"shortdesc" : "Write debug information to given file",
"order" : 52 },
+ "delay" : {
+ "getopt" : "f:",
+ "longopt" : "delay",
+ "help" : "--delay <seconds> Wait X seconds before fencing is started",
+ "default" : "0",
+ "order" : 200 },
"agent" : {
"getopt" : "",
"help" : "",
@@ -373,7 +379,7 @@ all_opt = {
"order" : 200 }
}
-common_opt = [ "retry_on" ]
+common_opt = [ "retry_on", "delay" ]
class fspawn(pexpect.spawn):
def log_expect(self, options, pattern, timeout):
@@ -606,7 +612,7 @@ def check_input(device_opt, opt):
##
## Add options which are available for every fence agent
#####
- device_opt.extend(common_opt)
+ device_opt.extend([x for x in common_opt if device_opt.count(x) == 0])
options = dict(opt)
options["device_opt"] = device_opt
@@ -748,6 +754,8 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
print o + options["-C"] + alias
return
+ if options["-o"] in ["off", "reboot"]:
+ time.sleep(int(options["-f"]))
status = get_power_fn(tn, options)
if status != "on" and status != "off":
13 years, 9 months
cluster: STABLE3 - fencing: Method to cause one node to delay fencing - ipmilan
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 274e85bc92fa3ffc5405dc2598b190d8470d0b32
Parent: 91450b013aefe5374c330b83b515da11f5daf338
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 2 15:26:31 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 15:52:37 2010 +0200
fencing: Method to cause one node to delay fencing - ipmilan
Resolves: rhbz#614046
---
fence/agents/ipmilan/ipmilan.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 58a86c9..39c8fb1 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -166,6 +166,7 @@ struct xml_parameter_s xml_parameters[]={
{"timeout","-t",0,"string",NULL,"Timeout (sec) for IPMI operation"},
{"cipher","-C",0,"string",NULL,"Ciphersuite to use (same as ipmitool -C parameter)"},
{"method","-M",0,"string",DEFAULT_METHOD,"Method to fence (onoff or cycle)"},
+ {"delay","-f",0,"string",NULL,"Wait X seconds before fencing is started"},
{"verbose","-v",0,"boolean",NULL,"Verbose mode"}};
/*
@@ -684,7 +685,8 @@ get_options_stdin(char *ip, size_t iplen,
char *user, size_t userlen,
char *op, size_t oplen,
int *lanplus, int *verbose,int *timeout,
- int *cipher, char *method, int methodlen)
+ int *cipher, char *method, int methodlen,
+ char *delay, size_t delaylen)
{
char in[256];
int line = 0;
@@ -764,6 +766,11 @@ get_options_stdin(char *ip, size_t iplen,
strncpy(op, val, oplen);
else
op[0] = 0;
+ } else if (!strcasecmp(name,"delay")) {
+ if (val)
+ strncpy(delay, val, delaylen);
+ else
+ delay[0] = 0;
}
}
@@ -797,6 +804,7 @@ printf(" -l <login> Username/Login (if required) to control power\n"
printf(" -o <op> Operation to perform.\n");
printf(" Valid operations: on, off, reboot, status, list or monitor\n");
printf(" -t <timeout> Timeout (sec) for IPMI operation (default %d)\n",DEFAULT_TIMEOUT);
+printf(" -f <timeout> Wait X seconds before fencing is started\n");
printf(" -C <cipher> Ciphersuite to use (same as ipmitool -C parameter)\n");
printf(" -M <method> Method to fence (onoff or cycle (default %s)\n", DEFAULT_METHOD);
printf(" -V Print version and exit\n");
@@ -812,6 +820,7 @@ printf(" login=<login> Same as -u\n");
printf(" option=<op> Same as -o\n");
printf(" operation=<op> Same as -o\n");
printf(" action=<op> Same as -o\n");
+printf(" delay=<seconds> Same as -f\n");
printf(" timeout=<timeout> Same as -t\n");
printf(" cipher=<cipher> Same as -C\n");
printf(" method=<method> Same as -M\n");
@@ -874,6 +883,7 @@ main(int argc, char **argv)
char user[64];
char op[64];
char method[64];
+ char delay[64];
char pwd_script[PATH_MAX] = { 0, };
int lanplus=0;
int verbose=0;
@@ -890,12 +900,13 @@ main(int argc, char **argv)
memset(user, 0, sizeof(user));
memset(op, 0, sizeof(op));
memset(method, 0, sizeof(method));
+ memset(delay, 0, sizeof(delay));
if (argc > 1) {
/*
Parse command line options if any were specified
*/
- while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:C:M:")) != EOF) {
+ while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:C:M:f:")) != EOF) {
switch(opt) {
case 'A':
/* Auth type */
@@ -925,6 +936,10 @@ main(int argc, char **argv)
/* Operation */
strncpy(op, optarg, sizeof(op));
break;
+ case 'f':
+ /* Delay */
+ strncpy(delay, optarg, sizeof(delay));
+ break;
case 't':
/* Timeout */
if ((sscanf(optarg,"%d",&timeout)!=1) || timeout<1) {
@@ -965,7 +980,8 @@ main(int argc, char **argv)
pwd_script, sizeof(pwd_script),
user, sizeof(user),
op, sizeof(op), &lanplus, &verbose,&timeout,
- &cipher, method, sizeof(method)) != 0)
+ &cipher, method, sizeof(method),
+ delay, sizeof(delay)) != 0)
return 1;
}
@@ -1036,6 +1052,13 @@ main(int argc, char **argv)
fail_exit("cycle method supports only 'reboot' operation (not 'on' or 'off').");
}
+ /* Delay fencing if requested */
+ if (delay) {
+ if (!strcasecmp(op, "reboot") || !strcasecmp(op, "off")) {
+ sleep(atoi(delay));
+ }
+ }
+
/* Ok, set up the IPMI struct */
i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, cipher);
if (!i)
13 years, 9 months
cluster: STABLE3 - fencing: Method to cause one node to delay fencing - drac, egenera
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 91450b013aefe5374c330b83b515da11f5daf338
Parent: 59222e02a1f69cbd8956f7ac39b515a8c038a15d
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 2 14:31:59 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)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";
13 years, 9 months
cluster: STABLE3 - fencing: Method to cause one node to delay fencing [2]
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 59222e02a1f69cbd8956f7ac39b515a8c038a15d
Parent: 52e9397d969966542367e832c6a3eff91204c117
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Jul 28 14:54:44 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 15:52:00 2010 +0200
fencing: Method to cause one node to delay fencing [2]
Option was not correctly showed in metadata
Resolves: rhbz#614046
---
fence/agents/lib/fencing.py.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index c5dd80a..7e9343f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -67,6 +67,8 @@ all_opt = {
"getopt" : "f:",
"longopt" : "delay",
"help" : "--delay <seconds> Wait X seconds before fencing is started",
+ "required" : "0",
+ "shortdesc" : "Wait X seconds before fencing is started",
"default" : "0",
"order" : 200 },
"agent" : {
13 years, 9 months
cluster: STABLE3 - fencing: Method to cause one node to delay fencing
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 52e9397d969966542367e832c6a3eff91204c117
Parent: a598fada75f0e138b715b5da11d33b3040a2c903
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 2 15:51:23 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 15:51:23 2010 +0200
fencing: Method to cause one node to delay fencing
Patch to fencing library
Resolves: rhbz#614046
---
fence/agents/lib/fencing.py.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 3289eb5..c5dd80a 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -63,6 +63,12 @@ all_opt = {
"required" : "0",
"shortdesc" : "Write debug information to given file",
"order" : 52 },
+ "delay" : {
+ "getopt" : "f:",
+ "longopt" : "delay",
+ "help" : "--delay <seconds> Wait X seconds before fencing is started",
+ "default" : "0",
+ "order" : 200 },
"agent" : {
"getopt" : "",
"help" : "",
@@ -369,7 +375,7 @@ all_opt = {
"order" : 200 }
}
-common_opt = [ "retry_on" ]
+common_opt = [ "retry_on", "delay" ]
class fspawn(pexpect.spawn):
def log_expect(self, options, pattern, timeout):
@@ -602,7 +608,7 @@ def check_input(device_opt, opt):
##
## Add options which are available for every fence agent
#####
- device_opt.extend(common_opt)
+ device_opt.extend([x for x in common_opt if device_opt.count(x) == 0])
options = dict(opt)
options["device_opt"] = device_opt
@@ -744,6 +750,8 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
print o + options["-C"] + alias
return
+ if options["-o"] in ["off", "reboot"]:
+ time.sleep(int(options["-f"]))
status = get_power_fn(tn, options)
if status != "on" and status != "off":
13 years, 9 months
fence-agents: master - fencing: Method to cause one node to delay fencing - ipmilan
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 094ebf49796a01f93b1468aabac03e647cffc817
Parent: 446b91fc5c9872ab578868cedf52f80590cd551d
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 2 15:26:31 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 15:26:31 2010 +0200
fencing: Method to cause one node to delay fencing - ipmilan
Resolves: rhbz#614046
---
fence/agents/ipmilan/ipmilan.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 51f2f40..424a867 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -169,6 +169,7 @@ struct xml_parameter_s xml_parameters[]={
{"timeout","-t",0,"string",NULL,"Timeout (sec) for IPMI operation"},
{"cipher","-C",0,"string",NULL,"Ciphersuite to use (same as ipmitool -C parameter)"},
{"method","-M",0,"string",DEFAULT_METHOD,"Method to fence (onoff or cycle)"},
+ {"delay","-f",0,"string",NULL,"Wait X seconds before fencing is started"},
{"verbose","-v",0,"boolean",NULL,"Verbose mode"}};
/*
@@ -687,7 +688,8 @@ get_options_stdin(char *ip, size_t iplen,
char *user, size_t userlen,
char *op, size_t oplen,
int *lanplus, int *verbose,int *timeout,
- int *cipher, char *method, int methodlen)
+ int *cipher, char *method, int methodlen,
+ char *delay, size_t delaylen)
{
char in[256];
int line = 0;
@@ -767,6 +769,11 @@ get_options_stdin(char *ip, size_t iplen,
strncpy(op, val, oplen);
else
op[0] = 0;
+ } else if (!strcasecmp(name,"delay")) {
+ if (val)
+ strncpy(delay, val, delaylen);
+ else
+ delay[0] = 0;
}
}
@@ -800,6 +807,7 @@ printf(" -l <login> Username/Login (if required) to control power\n"
printf(" -o <op> Operation to perform.\n");
printf(" Valid operations: on, off, reboot, status, list or monitor\n");
printf(" -t <timeout> Timeout (sec) for IPMI operation (default %d)\n",DEFAULT_TIMEOUT);
+printf(" -f <timeout> Wait X seconds before fencing is started\n");
printf(" -C <cipher> Ciphersuite to use (same as ipmitool -C parameter)\n");
printf(" -M <method> Method to fence (onoff or cycle (default %s)\n", DEFAULT_METHOD);
printf(" -V Print version and exit\n");
@@ -815,6 +823,7 @@ printf(" login=<login> Same as -u\n");
printf(" option=<op> Same as -o\n");
printf(" operation=<op> Same as -o\n");
printf(" action=<op> Same as -o\n");
+printf(" delay=<seconds> Same as -f\n");
printf(" timeout=<timeout> Same as -t\n");
printf(" cipher=<cipher> Same as -C\n");
printf(" method=<method> Same as -M\n");
@@ -877,6 +886,7 @@ main(int argc, char **argv)
char user[64];
char op[64];
char method[64];
+ char delay[64];
char pwd_script[PATH_MAX] = { 0, };
int lanplus=0;
int verbose=0;
@@ -893,12 +903,13 @@ main(int argc, char **argv)
memset(user, 0, sizeof(user));
memset(op, 0, sizeof(op));
memset(method, 0, sizeof(method));
+ memset(delay, 0, sizeof(delay));
if (argc > 1) {
/*
Parse command line options if any were specified
*/
- while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:C:M:")) != EOF) {
+ while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:C:M:f:")) != EOF) {
switch(opt) {
case 'A':
/* Auth type */
@@ -928,6 +939,10 @@ main(int argc, char **argv)
/* Operation */
strncpy(op, optarg, sizeof(op));
break;
+ case 'f':
+ /* Delay */
+ strncpy(delay, optarg, sizeof(delay));
+ break;
case 't':
/* Timeout */
if ((sscanf(optarg,"%d",&timeout)!=1) || timeout<1) {
@@ -968,7 +983,8 @@ main(int argc, char **argv)
pwd_script, sizeof(pwd_script),
user, sizeof(user),
op, sizeof(op), &lanplus, &verbose,&timeout,
- &cipher, method, sizeof(method)) != 0)
+ &cipher, method, sizeof(method),
+ delay, sizeof(delay)) != 0)
return 1;
}
@@ -1039,6 +1055,13 @@ main(int argc, char **argv)
fail_exit("cycle method supports only 'reboot' operation (not 'on' or 'off').");
}
+ /* Delay fencing if requested */
+ if (delay) {
+ if (!strcasecmp(op, "reboot") || !strcasecmp(op, "off")) {
+ sleep(atoi(delay));
+ }
+ }
+
/* Ok, set up the IPMI struct */
i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, cipher);
if (!i)
13 years, 9 months
fence-agents: master - fencing: Method to cause one node to delay fencing - drac, egenera
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 446b91fc5c9872ab578868cedf52f80590cd551d
Parent: 0e84b2e3f6ef1be68cbdb2414eb257f879f43af7
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 2 14:31:59 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 14:31:59 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";
13 years, 9 months
cluster: RHEL56 - fence_drac5: make "port" a synonym of "module_name" for drac5
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 960b39695fab477e5b63b6aa16aa4d86d717233a
Parent: 773287f0f3952b33d585a1f13114636ce7ff0488
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Jul 30 17:58:01 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Aug 2 11:11:27 2010 +0200
fence_drac5: make "port" a synonym of "module_name" for drac5
Resolves: rhbz#619776
---
fence/agents/lib/fencing.py.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index e44632b..fd828a3 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -517,6 +517,11 @@ def process_input(avail_opt):
else:
longopt_list.append(all_opt[k]["longopt"])
+ ## Compatibility layer
+ if avail_opt.count("module_name") == 1:
+ getopt_string += "n:"
+ longopt_list.append("plug=")
+
##
## Read options from command line or standard input
#####
@@ -543,6 +548,8 @@ def process_input(avail_opt):
z = dict(opt)
if z.has_key("-T") == 1:
z["-o"] = "status"
+ if z.has_key("-n") == 1:
+ z["-m"] = z["-n"]
opt = z
##
@@ -572,6 +579,8 @@ def process_input(avail_opt):
name = "module_name"
elif name == "action" and 1 == avail_opt.count("io_fencing"):
name = "io_fencing"
+ elif name == "port" and 1 == avail_opt.count("drac_version"):
+ name = "module_name"
##
######
13 years, 9 months