Blame SOURCES/bz1257137-2-fence_ipmilan_regression.patch

e4ffb1
From 4b06b842e57f80bda87ec57b9e0e047fe89ad25f Mon Sep 17 00:00:00 2001
e4ffb1
From: Marek 'marx' Grac <mgrac@redhat.com>
e4ffb1
Date: Wed, 26 Aug 2015 12:54:47 +0200
e4ffb1
Subject: [PATCH 2/3] fence_ipmilan: Re-introduce -t / timeout option
e4ffb1
e4ffb1
In the new fence agent this option was replaced by --*-timeout but old
e4ffb1
option should work as before. It sets all *-timeout to a value 'timeout'
e4ffb1
e4ffb1
Resolves: rhbz#1257137
e4ffb1
---
e4ffb1
 fence/agents/ipmilan/fence_ipmilan.py | 16 +++++++++++++++-
e4ffb1
 tests/data/metadata/fence_idrac.xml   | 23 ++++++++++++++---------
e4ffb1
 tests/data/metadata/fence_ilo3.xml    | 23 ++++++++++++++---------
e4ffb1
 tests/data/metadata/fence_ilo4.xml    | 23 ++++++++++++++---------
e4ffb1
 tests/data/metadata/fence_imm.xml     | 23 ++++++++++++++---------
e4ffb1
 tests/data/metadata/fence_ipmilan.xml | 23 ++++++++++++++---------
e4ffb1
 6 files changed, 85 insertions(+), 46 deletions(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
e4ffb1
index 8224b83..fd04110 100644
e4ffb1
--- a/fence/agents/ipmilan/fence_ipmilan.py
e4ffb1
+++ b/fence/agents/ipmilan/fence_ipmilan.py
e4ffb1
@@ -125,12 +125,21 @@ def define_new_opts():
e4ffb1
 		"help" : "",
e4ffb1
 		"order" : 1
e4ffb1
 	}
e4ffb1
+	all_opt["timeout"] = {
e4ffb1
+		"getopt" : "t:",
e4ffb1
+		"longopt" : "timeout",
e4ffb1
+		"help" : "-t [seconds]                   Timeout (sec) for IPMI operation",
e4ffb1
+		"required" : "0",
e4ffb1
+		"shortdesc" : "Timeout (sec) for IPMI operation",
e4ffb1
+		"order" : 1
e4ffb1
+	}
e4ffb1
 
e4ffb1
 def main():
e4ffb1
 	atexit.register(atexit_handler)
e4ffb1
 
e4ffb1
 	device_opt = ["ipaddr", "ipport", "login", "no_login", "no_password", "passwd",
e4ffb1
-		"lanplus", "auth", "cipher", "privlvl", "sudo", "ipmitool_path", "method", "obsolete_ip"]
e4ffb1
+		"lanplus", "auth", "cipher", "privlvl", "sudo", "ipmitool_path", "method",
e4ffb1
+		"obsolete_ip", "timeout"]
e4ffb1
 	define_new_opts()
e4ffb1
 
e4ffb1
 	if os.path.basename(sys.argv[0]) == "fence_ilo3":
e4ffb1
@@ -148,6 +157,11 @@ def main():
e4ffb1
 		pi["--ip"] = pi["--obsolete-ip"]
e4ffb1
 	options = check_input(device_opt, pi)
e4ffb1
 
e4ffb1
+	if "--timeout" in options:
e4ffb1
+		options["--shell-timeout"] = options["--timeout"]
e4ffb1
+		options["--power-timeout"] = options["--timeout"]
e4ffb1
+		options["--login-timeout"] = options["--timeout"]
e4ffb1
+
e4ffb1
 	docs = {}
e4ffb1
 	docs["shortdesc"] = "Fence agent for IPMI"
e4ffb1
 	docs["longdesc"] = "fence_ipmilan is an I/O Fencing agent\
e4ffb1
diff --git a/tests/data/metadata/fence_idrac.xml b/tests/data/metadata/fence_idrac.xml
e4ffb1
index 0aced2a..6e0b834 100644
e4ffb1
--- a/tests/data/metadata/fence_idrac.xml
e4ffb1
+++ b/tests/data/metadata/fence_idrac.xml
e4ffb1
@@ -64,6 +64,11 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">IPMI Lan Auth type.</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="action" unique="0" required="1">
e4ffb1
+		<getopt mixed="-o, --action=[action]" />
e4ffb1
+		<content type="string" default="reboot"  />
e4ffb1
+		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="cipher" unique="0" required="0">
e4ffb1
 		<getopt mixed="-C, --cipher=[cipher]" />
e4ffb1
 		<content type="string"  />
e4ffb1
@@ -79,10 +84,10 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">Privilege level on IPMI device</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="action" unique="0" required="1">
e4ffb1
-		<getopt mixed="-o, --action=[action]" />
e4ffb1
-		<content type="string" default="reboot"  />
e4ffb1
-		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	<parameter name="timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="-t [seconds]                   Timeout (sec) for IPMI operation" />
e4ffb1
+		<content type="string"  />
e4ffb1
+		<shortdesc lang="en">Timeout (sec) for IPMI operation</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
 	<parameter name="login" unique="0" required="0">
e4ffb1
 		<getopt mixed="-l, --username=[name]" />
e4ffb1
@@ -119,16 +124,16 @@
e4ffb1
 		<content type="string" default="5"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
-		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
-		<content type="string" default="20"  />
e4ffb1
-		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
-	</parameter>
e4ffb1
 	<parameter name="delay" unique="0" required="0">
e4ffb1
 		<getopt mixed="--delay=[seconds]" />
e4ffb1
 		<content type="string" default="0"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
+		<content type="string" default="20"  />
e4ffb1
+		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="ipmitool_path" unique="0" required="0">
e4ffb1
 		<getopt mixed="--ipmitool-path=[path]" />
e4ffb1
 		<content type="string" default="/usr/bin/ipmitool"  />
e4ffb1
diff --git a/tests/data/metadata/fence_ilo3.xml b/tests/data/metadata/fence_ilo3.xml
e4ffb1
index 67e869b..1253539 100644
e4ffb1
--- a/tests/data/metadata/fence_ilo3.xml
e4ffb1
+++ b/tests/data/metadata/fence_ilo3.xml
e4ffb1
@@ -64,6 +64,11 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">IPMI Lan Auth type.</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="action" unique="0" required="1">
e4ffb1
+		<getopt mixed="-o, --action=[action]" />
e4ffb1
+		<content type="string" default="reboot"  />
e4ffb1
+		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="cipher" unique="0" required="0">
e4ffb1
 		<getopt mixed="-C, --cipher=[cipher]" />
e4ffb1
 		<content type="string"  />
e4ffb1
@@ -79,10 +84,10 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">Privilege level on IPMI device</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="action" unique="0" required="1">
e4ffb1
-		<getopt mixed="-o, --action=[action]" />
e4ffb1
-		<content type="string" default="reboot"  />
e4ffb1
-		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	<parameter name="timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="-t [seconds]                   Timeout (sec) for IPMI operation" />
e4ffb1
+		<content type="string"  />
e4ffb1
+		<shortdesc lang="en">Timeout (sec) for IPMI operation</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
 	<parameter name="login" unique="0" required="0">
e4ffb1
 		<getopt mixed="-l, --username=[name]" />
e4ffb1
@@ -119,16 +124,16 @@
e4ffb1
 		<content type="string" default="5"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
-		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
-		<content type="string" default="20"  />
e4ffb1
-		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
-	</parameter>
e4ffb1
 	<parameter name="delay" unique="0" required="0">
e4ffb1
 		<getopt mixed="--delay=[seconds]" />
e4ffb1
 		<content type="string" default="0"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
+		<content type="string" default="20"  />
e4ffb1
+		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="ipmitool_path" unique="0" required="0">
e4ffb1
 		<getopt mixed="--ipmitool-path=[path]" />
e4ffb1
 		<content type="string" default="/usr/bin/ipmitool"  />
e4ffb1
diff --git a/tests/data/metadata/fence_ilo4.xml b/tests/data/metadata/fence_ilo4.xml
e4ffb1
index b7dd31a..6498be8 100644
e4ffb1
--- a/tests/data/metadata/fence_ilo4.xml
e4ffb1
+++ b/tests/data/metadata/fence_ilo4.xml
e4ffb1
@@ -64,6 +64,11 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">IPMI Lan Auth type.</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="action" unique="0" required="1">
e4ffb1
+		<getopt mixed="-o, --action=[action]" />
e4ffb1
+		<content type="string" default="reboot"  />
e4ffb1
+		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="cipher" unique="0" required="0">
e4ffb1
 		<getopt mixed="-C, --cipher=[cipher]" />
e4ffb1
 		<content type="string"  />
e4ffb1
@@ -79,10 +84,10 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">Privilege level on IPMI device</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="action" unique="0" required="1">
e4ffb1
-		<getopt mixed="-o, --action=[action]" />
e4ffb1
-		<content type="string" default="reboot"  />
e4ffb1
-		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	<parameter name="timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="-t [seconds]                   Timeout (sec) for IPMI operation" />
e4ffb1
+		<content type="string"  />
e4ffb1
+		<shortdesc lang="en">Timeout (sec) for IPMI operation</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
 	<parameter name="login" unique="0" required="0">
e4ffb1
 		<getopt mixed="-l, --username=[name]" />
e4ffb1
@@ -119,16 +124,16 @@
e4ffb1
 		<content type="string" default="5"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
-		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
-		<content type="string" default="20"  />
e4ffb1
-		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
-	</parameter>
e4ffb1
 	<parameter name="delay" unique="0" required="0">
e4ffb1
 		<getopt mixed="--delay=[seconds]" />
e4ffb1
 		<content type="string" default="0"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
+		<content type="string" default="20"  />
e4ffb1
+		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="ipmitool_path" unique="0" required="0">
e4ffb1
 		<getopt mixed="--ipmitool-path=[path]" />
e4ffb1
 		<content type="string" default="/usr/bin/ipmitool"  />
e4ffb1
diff --git a/tests/data/metadata/fence_imm.xml b/tests/data/metadata/fence_imm.xml
e4ffb1
index 0e7588d..e6d67bc 100644
e4ffb1
--- a/tests/data/metadata/fence_imm.xml
e4ffb1
+++ b/tests/data/metadata/fence_imm.xml
e4ffb1
@@ -64,6 +64,11 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">IPMI Lan Auth type.</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="action" unique="0" required="1">
e4ffb1
+		<getopt mixed="-o, --action=[action]" />
e4ffb1
+		<content type="string" default="reboot"  />
e4ffb1
+		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="cipher" unique="0" required="0">
e4ffb1
 		<getopt mixed="-C, --cipher=[cipher]" />
e4ffb1
 		<content type="string"  />
e4ffb1
@@ -79,10 +84,10 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">Privilege level on IPMI device</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="action" unique="0" required="1">
e4ffb1
-		<getopt mixed="-o, --action=[action]" />
e4ffb1
-		<content type="string" default="reboot"  />
e4ffb1
-		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	<parameter name="timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="-t [seconds]                   Timeout (sec) for IPMI operation" />
e4ffb1
+		<content type="string"  />
e4ffb1
+		<shortdesc lang="en">Timeout (sec) for IPMI operation</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
 	<parameter name="login" unique="0" required="0">
e4ffb1
 		<getopt mixed="-l, --username=[name]" />
e4ffb1
@@ -119,16 +124,16 @@
e4ffb1
 		<content type="string" default="5"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
-		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
-		<content type="string" default="20"  />
e4ffb1
-		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
-	</parameter>
e4ffb1
 	<parameter name="delay" unique="0" required="0">
e4ffb1
 		<getopt mixed="--delay=[seconds]" />
e4ffb1
 		<content type="string" default="0"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
+		<content type="string" default="20"  />
e4ffb1
+		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="ipmitool_path" unique="0" required="0">
e4ffb1
 		<getopt mixed="--ipmitool-path=[path]" />
e4ffb1
 		<content type="string" default="/usr/bin/ipmitool"  />
e4ffb1
diff --git a/tests/data/metadata/fence_ipmilan.xml b/tests/data/metadata/fence_ipmilan.xml
e4ffb1
index 443365c..97edfbb 100644
e4ffb1
--- a/tests/data/metadata/fence_ipmilan.xml
e4ffb1
+++ b/tests/data/metadata/fence_ipmilan.xml
e4ffb1
@@ -64,6 +64,11 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">IPMI Lan Auth type.</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="action" unique="0" required="1">
e4ffb1
+		<getopt mixed="-o, --action=[action]" />
e4ffb1
+		<content type="string" default="reboot"  />
e4ffb1
+		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="cipher" unique="0" required="0">
e4ffb1
 		<getopt mixed="-C, --cipher=[cipher]" />
e4ffb1
 		<content type="string"  />
e4ffb1
@@ -79,10 +84,10 @@
e4ffb1
 		</content>
e4ffb1
 		<shortdesc lang="en">Privilege level on IPMI device</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="action" unique="0" required="1">
e4ffb1
-		<getopt mixed="-o, --action=[action]" />
e4ffb1
-		<content type="string" default="reboot"  />
e4ffb1
-		<shortdesc lang="en">Fencing Action</shortdesc>
e4ffb1
+	<parameter name="timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="-t [seconds]                   Timeout (sec) for IPMI operation" />
e4ffb1
+		<content type="string"  />
e4ffb1
+		<shortdesc lang="en">Timeout (sec) for IPMI operation</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
 	<parameter name="login" unique="0" required="0">
e4ffb1
 		<getopt mixed="-l, --username=[name]" />
e4ffb1
@@ -119,16 +124,16 @@
e4ffb1
 		<content type="string" default="5"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
-	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
-		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
-		<content type="string" default="20"  />
e4ffb1
-		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
-	</parameter>
e4ffb1
 	<parameter name="delay" unique="0" required="0">
e4ffb1
 		<getopt mixed="--delay=[seconds]" />
e4ffb1
 		<content type="string" default="0"  />
e4ffb1
 		<shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
e4ffb1
 	</parameter>
e4ffb1
+	<parameter name="power_timeout" unique="0" required="0">
e4ffb1
+		<getopt mixed="--power-timeout=[seconds]" />
e4ffb1
+		<content type="string" default="20"  />
e4ffb1
+		<shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
e4ffb1
+	</parameter>
e4ffb1
 	<parameter name="ipmitool_path" unique="0" required="0">
e4ffb1
 		<getopt mixed="--ipmitool-path=[path]" />
e4ffb1
 		<content type="string" default="/usr/bin/ipmitool"  />
e4ffb1
-- 
e4ffb1
1.9.3
e4ffb1