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":