commit 460609f46485cd39f1ea158a00e1ca8fa3dd809f Author: Marek 'marx' Grac <mgrac@redhat.com> Date: Wed Oct 14 13:59:13 2009 +0200 fencing: New option '--missing-as-off' to return OFF is machine is missing If a blade is not present (i.e. removed for maintenance), the fence_bladecenter cannot check the state as it is reported empty. Resolves: bz#248006 diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py index 87819e4..d55f31a 100644 --- a/fence/agents/bladecenter/fence_bladecenter.py +++ b/fence/agents/bladecenter/fence_bladecenter.py @@ -30,7 +30,10 @@ def get_power_status(conn, options): i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["-Y"])) if i == 1: ## Given blade number does not exist - fail(EC_STATUS) + if options.has_key("-M"): + return "off" + else: + fail(EC_STATUS) conn.send("power -state\r\n") conn.log_expect(options, node_cmd, int(options["-Y"])) status = conn.before.splitlines()[-1] @@ -92,7 +95,7 @@ def main(): "action", "ipaddr", "login", "passwd", "passwd_script", "cmd_prompt", "secure", "port", "identity_file", "separator", "inet4_only", "inet6_only", "ipport", - "power_timeout", "shell_timeout", "login_timeout", "power_wait" ] + "power_timeout", "shell_timeout", "login_timeout", "power_wait", "missing_as_off" ] atexit.register(atexit_handler) diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index fe83a3f..9df1190 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -342,7 +342,12 @@ all_opt = { "longopt" : "power-wait", "help" : "--power-wait <seconds> Wait X seconds after issuing ON/OFF", "default" : "0", - "order" : 200 } + "order" : 200 }, + "missing_as_off" : { + "getopt" : "M", + "longopt" : "missing-as-off", + "help" : "--missing-as-off Missing port returns OFF instead of failure", + "order" : 200} } class fspawn(pexpect.spawn):