|
|
09283b |
diff -uNr a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
|
|
|
09283b |
--- a/fence/agents/ipmilan/fence_ipmilan.py 2016-03-14 10:33:38.419438036 +0100
|
|
|
09283b |
+++ b/fence/agents/ipmilan/fence_ipmilan.py 2016-03-14 10:41:41.376326426 +0100
|
|
|
09283b |
@@ -27,6 +27,10 @@
|
|
|
09283b |
output = run_command(options, create_command(options, "cycle"))
|
|
|
09283b |
return bool(re.search('chassis power control: cycle', str(output).lower()))
|
|
|
09283b |
|
|
|
09283b |
+def reboot_diag(_, options):
|
|
|
09283b |
+ output = run_command(options, create_command(options, "diag"))
|
|
|
09283b |
+ return bool(re.search('chassis power control: diag', str(output).lower()))
|
|
|
09283b |
+
|
|
|
09283b |
def create_command(options, action):
|
|
|
09283b |
cmd = options["--ipmitool-path"]
|
|
|
09283b |
|
|
|
09283b |
@@ -137,7 +141,7 @@
|
|
|
09283b |
def main():
|
|
|
09283b |
atexit.register(atexit_handler)
|
|
|
09283b |
|
|
|
09283b |
- device_opt = ["ipaddr", "ipport", "login", "no_login", "no_password", "passwd",
|
|
|
09283b |
+ device_opt = ["ipaddr", "login", "no_login", "no_password", "passwd", "diag",
|
|
|
09283b |
"lanplus", "auth", "cipher", "privlvl", "sudo", "ipmitool_path", "method",
|
|
|
09283b |
"obsolete_ip", "timeout"]
|
|
|
09283b |
define_new_opts()
|
|
|
09283b |
@@ -179,7 +183,15 @@
|
|
|
09283b |
if not is_executable(options["--ipmitool-path"]):
|
|
|
09283b |
fail_usage("Ipmitool not found or not accessible")
|
|
|
09283b |
|
|
|
09283b |
- result = fence_action(None, options, set_power_status, get_power_status, None, reboot_cycle)
|
|
|
09283b |
+ reboot_fn = reboot_cycle
|
|
|
09283b |
+ if options["--action"] == "diag":
|
|
|
09283b |
+ # Diag is a special action that can't be verified so we will reuse reboot functionality
|
|
|
09283b |
+ # to minimize impact on generic library
|
|
|
09283b |
+ options["--action"] = "reboot"
|
|
|
09283b |
+ options["--method"] = "cycle"
|
|
|
09283b |
+ reboot_fn = reboot_diag
|
|
|
09283b |
+
|
|
|
09283b |
+ result = fence_action(None, options, set_power_status, get_power_status, None, reboot_fn)
|
|
|
09283b |
sys.exit(result)
|
|
|
09283b |
|
|
|
09283b |
if __name__ == "__main__":
|
|
|
09283b |
diff -uNr a/fence/agents/lib/fence2man.xsl b/fence/agents/lib/fence2man.xsl
|
|
|
09283b |
--- a/fence/agents/lib/fence2man.xsl 2016-03-14 10:33:38.411438131 +0100
|
|
|
09283b |
+++ b/fence/agents/lib/fence2man.xsl 2016-03-14 10:41:41.377326413 +0100
|
|
|
09283b |
@@ -20,6 +20,7 @@
|
|
|
09283b |
<xsl:when test="@name = 'enable'">Enable fabric access.</xsl:when>
|
|
|
09283b |
<xsl:when test="@name = 'disable'">Disable fabric access.</xsl:when>
|
|
|
09283b |
<xsl:when test="@name = 'reboot'">Reboot machine.</xsl:when>
|
|
|
09283b |
+<xsl:when test="@name = 'diag'">Pulse a diagnostic interrupt to the processor(s).</xsl:when>
|
|
|
09283b |
<xsl:when test="@name = 'monitor'">Check the health of fence device</xsl:when>
|
|
|
09283b |
<xsl:when test="@name = 'metadata'">Display the XML metadata describing this resource.</xsl:when>
|
|
|
09283b |
<xsl:when test="@name = 'list'">List available plugs with aliases/virtual machines if there is support for more then one device. Returns N/A otherwise.</xsl:when>
|
|
|
09283b |
diff -uNr a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
|
|
|
09283b |
--- a/fence/agents/lib/fencing.py.py 2016-03-14 10:33:38.418438048 +0100
|
|
|
09283b |
+++ b/fence/agents/lib/fencing.py.py 2016-03-14 10:41:44.366288571 +0100
|
|
|
09283b |
@@ -135,6 +135,10 @@
|
|
|
09283b |
"getopt" : "",
|
|
|
09283b |
"help" : "",
|
|
|
09283b |
"order" : 1},
|
|
|
09283b |
+ "diag" : {
|
|
|
09283b |
+ "getopt" : "",
|
|
|
09283b |
+ "help" : "",
|
|
|
09283b |
+ "order" : ""},
|
|
|
09283b |
"passwd" : {
|
|
|
09283b |
"getopt" : "p:",
|
|
|
09283b |
"longopt" : "password",
|
|
|
09283b |
@@ -590,6 +594,8 @@
|
|
|
09283b |
print "\t<action name=\"list-status\" />"
|
|
|
09283b |
print "\t<action name=\"monitor\" />"
|
|
|
09283b |
print "\t<action name=\"metadata\" />"
|
|
|
09283b |
+ if avail_opt.count("diag") == 1:
|
|
|
09283b |
+ print "\t<action name=\"diag\" />"
|
|
|
09283b |
print "</actions>"
|
|
|
09283b |
print "</resource-agent>"
|
|
|
09283b |
|
|
|
09283b |
@@ -781,6 +787,9 @@
|
|
|
09283b |
if 1 == device_opt.count("no_status"):
|
|
|
09283b |
acceptable_actions.remove("status")
|
|
|
09283b |
|
|
|
09283b |
+ if 1 == device_opt.count("diag"):
|
|
|
09283b |
+ acceptable_actions.extend(["diag"])
|
|
|
09283b |
+
|
|
|
09283b |
if 0 == acceptable_actions.count(options["--action"]):
|
|
|
09283b |
fail_usage("Failed: Unrecognised action '" + options["--action"] + "'")
|
|
|
09283b |
|
|
|
09283b |
diff -uNr a/tests/data/metadata/fence_idrac.xml b/tests/data/metadata/fence_idrac.xml
|
|
|
09283b |
--- a/tests/data/metadata/fence_idrac.xml 2016-03-14 10:33:38.416438072 +0100
|
|
|
09283b |
+++ b/tests/data/metadata/fence_idrac.xml 2016-03-14 10:41:41.379326388 +0100
|
|
|
09283b |
@@ -169,5 +169,6 @@
|
|
|
09283b |
<action name="list-status" />
|
|
|
09283b |
<action name="monitor" />
|
|
|
09283b |
<action name="metadata" />
|
|
|
09283b |
+ <action name="diag" />
|
|
|
09283b |
</actions>
|
|
|
09283b |
</resource-agent>
|
|
|
09283b |
diff -uNr a/tests/data/metadata/fence_ilo3.xml b/tests/data/metadata/fence_ilo3.xml
|
|
|
09283b |
--- a/tests/data/metadata/fence_ilo3.xml 2016-03-14 10:33:38.416438072 +0100
|
|
|
09283b |
+++ b/tests/data/metadata/fence_ilo3.xml 2016-03-14 10:41:41.379326388 +0100
|
|
|
09283b |
@@ -169,5 +169,6 @@
|
|
|
09283b |
<action name="list-status" />
|
|
|
09283b |
<action name="monitor" />
|
|
|
09283b |
<action name="metadata" />
|
|
|
09283b |
+ <action name="diag" />
|
|
|
09283b |
</actions>
|
|
|
09283b |
</resource-agent>
|
|
|
09283b |
diff -uNr a/tests/data/metadata/fence_ilo4.xml b/tests/data/metadata/fence_ilo4.xml
|
|
|
09283b |
--- a/tests/data/metadata/fence_ilo4.xml 2016-03-14 10:33:38.416438072 +0100
|
|
|
09283b |
+++ b/tests/data/metadata/fence_ilo4.xml 2016-03-14 10:41:41.380326375 +0100
|
|
|
09283b |
@@ -169,5 +169,6 @@
|
|
|
09283b |
<action name="list-status" />
|
|
|
09283b |
<action name="monitor" />
|
|
|
09283b |
<action name="metadata" />
|
|
|
09283b |
+ <action name="diag" />
|
|
|
09283b |
</actions>
|
|
|
09283b |
</resource-agent>
|
|
|
09283b |
diff -uNr a/tests/data/metadata/fence_imm.xml b/tests/data/metadata/fence_imm.xml
|
|
|
09283b |
--- a/tests/data/metadata/fence_imm.xml 2016-03-14 10:33:38.416438072 +0100
|
|
|
09283b |
+++ b/tests/data/metadata/fence_imm.xml 2016-03-14 10:41:41.380326375 +0100
|
|
|
09283b |
@@ -169,5 +169,6 @@
|
|
|
09283b |
<action name="list-status" />
|
|
|
09283b |
<action name="monitor" />
|
|
|
09283b |
<action name="metadata" />
|
|
|
09283b |
+ <action name="diag" />
|
|
|
09283b |
</actions>
|
|
|
09283b |
</resource-agent>
|
|
|
09283b |
diff -uNr a/tests/data/metadata/fence_ipmilan.xml b/tests/data/metadata/fence_ipmilan.xml
|
|
|
09283b |
--- a/tests/data/metadata/fence_ipmilan.xml 2016-03-14 10:33:38.416438072 +0100
|
|
|
09283b |
+++ b/tests/data/metadata/fence_ipmilan.xml 2016-03-14 10:41:41.381326363 +0100
|
|
|
09283b |
@@ -169,5 +169,6 @@
|
|
|
09283b |
<action name="list-status" />
|
|
|
09283b |
<action name="monitor" />
|
|
|
09283b |
<action name="metadata" />
|
|
|
09283b |
+ <action name="diag" />
|
|
|
09283b |
</actions>
|
|
|
09283b |
</resource-agent>
|