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