From 06499869a35807910749780c30e30a06893ceecb Mon Sep 17 00:00:00 2001 From: Marek 'marx' Grac <mgrac@redhat.com> Date: Mon, 2 Aug 2010 15:51:23 +0200 Subject: [PATCH] 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": -- 1.6.0.6