Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=c0498f...
Commit: c0498f38d29d8a89dbc44baac06f575be10148f6
Parent: 33aa9709b40af9727a6bf66f8c0e5ed3ef4572ca
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Apr 23 17:41:33 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 23 17:41:33 2014 +0200
fencing: Introduce new device option 'no_status'
Some fence agents are not able to obtain status e.g. fence_ovh or fence_kdump,
with this patch this can be reflected in metadata. Also fix for fence_ovh.
---
fence/agents/lib/fencing.py.py | 10 +++++++++-
fence/agents/ovh/fence_ovh.py | 3 ++-
tests/data/metadata/fence_ovh.xml | 1 -
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index ff4cf7f..474eb3b 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -125,6 +125,10 @@ all_opt = {
"getopt" : "",
"help" : "",
"order" : 1 },
+ "no_status" : {
+ "getopt" : "",
+ "help" : "",
+ "order" : 1 },
"passwd" : {
"getopt" : "p:",
"longopt" : "password",
@@ -524,7 +528,8 @@ def metadata(avail_opt, options, docs):
if avail_opt.count("fabric_fencing") == 0:
print "\t<action name=\"reboot\" />"
- print "\t<action name=\"status\" />"
+ if avail_opt.count("no_status") == 0:
+ print "\t<action name=\"status\" />"
print "\t<action name=\"list\" />"
print "\t<action name=\"monitor\" />"
print "\t<action name=\"metadata\" />"
@@ -694,6 +699,9 @@ def check_input(device_opt, opt):
else:
acceptable_actions.extend(["reboot"])
+ if 1 == device_opt.count("no_status"):
+ acceptable_actions.remove("status")
+
if 0 == acceptable_actions.count(options["--action"]):
fail_usage("Failed: Unrecognised action '" +
options["--action"] + "'")
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 0f460df..585b7d0 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -83,11 +83,12 @@ def remove_tmp_dir(tmp_dir):
shutil.rmtree(tmp_dir)
def main():
- device_opt = [ "login", "passwd", "port",
"email" ]
+ device_opt = [ "login", "passwd", "port",
"email", "no_status" ]
atexit.register(atexit_handler)
define_new_opts()
+ all_opt["action"]["help"] = "-o, --action=[action]
Action: reboot (default), off or on"
options = check_input(device_opt, process_input(device_opt))
docs = { }
diff --git a/tests/data/metadata/fence_ovh.xml b/tests/data/metadata/fence_ovh.xml
index 2c08dcb..522da6c 100644
--- a/tests/data/metadata/fence_ovh.xml
+++ b/tests/data/metadata/fence_ovh.xml
@@ -93,7 +93,6 @@
<action name="on" automatic="0"/>
<action name="off" />
<action name="reboot" />
- <action name="status" />
<action name="list" />
<action name="monitor" />
<action name="metadata" />