Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d236c5da97a239a1b6991cfba2865b66 > files > 34

cman-2.0.115-68.el5_6.1.src.rpm

commit d84550e21ad851cf97753c49aa25c8ded17e38ff
Author: Marek 'marx' Grac <mgrac@redhat.com>
Date:   Fri Oct 9 14:11:26 2009 +0200

    fencing: Timeout options added
    
    Fencing agents based on fencing library have new set of timeout options.
    Please read http://sources.redhat.com/cluster/wiki/FenceTiming for more
    information.
    
    General part of solution for bz#507514

diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 1c65e91..20efb49 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -30,7 +30,7 @@ def get_power_status(conn, options):
 	outlets = {}
 	try:
 		conn.send("1\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 
 		version = 0
 		admin = 0
@@ -63,13 +63,13 @@ def get_power_status(conn, options):
 					conn.send("3\r\n")
 			else:
 				conn.send("2\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+				conn.log_expect(options, options["-c"], int(options["-Y"]))
 				conn.send("1\r\n")
 		else:
 			conn.send(options["-s"]+"\r\n")
 			
 		while True:
-			exp_result = conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], SHELL_TIMEOUT)
+			exp_result = conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], int(options["-Y"]))
 			lines = conn.before.split("\n");
 			show_re = re.compile('^\s*(\d+)- (.*?)\s+(ON|OFF)\s*$')
 			for x in lines:
@@ -80,8 +80,8 @@ def get_power_status(conn, options):
 			if exp_result == 0:
 				break
 		conn.send(chr(03))		
-		conn.log_expect(options, "- Logout", SHELL_TIMEOUT)
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, "- Logout", int(options["-Y"]))
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -104,7 +104,7 @@ def set_power_status(conn, options):
 
 	try:
 		conn.send("1\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 
 		version = 0
 		admin2 = 0
@@ -143,7 +143,7 @@ def set_power_status(conn, options):
 					conn.send("3\r\n")
 			else:
 				conn.send("2\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+				conn.log_expect(options, options["-c"], int(options["-Y"]))
 				if (None == re.compile('.*2- Outlet Restriction.*', re.IGNORECASE | re.S).match(conn.before)):
 					admin3 = 0
 				else:
@@ -152,31 +152,31 @@ def set_power_status(conn, options):
 		else:
 			conn.send(options["-s"] + "\r\n")
 
-		while 1 == conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], SHELL_TIMEOUT):
+		while 1 == conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], int(options["-Y"])):
 			conn.send("\r\n")
 		conn.send(options["-n"]+"\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 
 		if switch == 0:
 			if admin2 == 1:
 				conn.send("1\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+				conn.log_expect(options, options["-c"], int(options["-Y"]))
 			if admin3 == 1:
 				conn.send("1\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+				conn.log_expect(options, options["-c"], int(options["-Y"]))
 		else:
 			conn.send("1\r\n")
-			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-Y"]))
 			
 		conn.send(action+"\r\n")
-		conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", SHELL_TIMEOUT)
+		conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", int(options["-Y"]))
 		conn.send("YES\r\n")
-		conn.log_expect(options, "Press <ENTER> to continue...", SHELL_TIMEOUT)
+		conn.log_expect(options, "Press <ENTER> to continue...", int(options["-Y"]))
 		conn.send("\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 		conn.send(chr(03))
-		conn.log_expect(options, "- Logout", SHELL_TIMEOUT)
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, "- Logout", int(options["-Y"]))
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -186,7 +186,8 @@ def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
 			"secure", "port", "switch", "test", "separator",
-			"inet4_only", "inet6_only", "ipport" ]
+			"inet4_only", "inet6_only", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 6479065..83f255c 100755
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -28,15 +28,15 @@ def get_power_status(conn, options):
 		node_cmd = "system:blade\[" + options["-n"] + "\]>"
 
 		conn.send("env -T system:blade[" + options["-n"] + "]\r\n")
-		i = conn.log_expect(options, [ node_cmd, "system>" ] , SHELL_TIMEOUT)
+		i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["-Y"]))
 		if i == 1:
 			## Given blade number does not exist
 			fail(EC_STATUS)
 		conn.send("power -state\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
+		conn.log_expect(options, node_cmd, int(options["-Y"]))
 		status = conn.before.splitlines()[-1]
 		conn.send("env -T system\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -54,11 +54,11 @@ def set_power_status(conn, options):
 		node_cmd = "system:blade\[" + options["-n"] + "\]>"
 
 		conn.send("env -T system:blade[" + options["-n"] + "]\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
+		conn.log_expect(options, node_cmd, int(options["-Y"]))
 		conn.send("power -"+options["-o"]+"\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
+		conn.log_expect(options, node_cmd, int(options["-Y"]))
 		conn.send("env -T system\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -70,9 +70,9 @@ def get_blades_list(conn, options):
 		node_cmd = "system>"
 
 		conn.send("env -T system\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
+		conn.log_expect(options, node_cmd, int(options["-Y"]))
 		conn.send("list -l 2\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
+		conn.log_expect(options, node_cmd, int(options["-Y"]))
 
 		lines = conn.before.split("\r\n")
 		filter_re = re.compile("^\s*blade\[(\d+)\]\s+(.*?)\s*$")
@@ -92,17 +92,15 @@ def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
 			"cmd_prompt", "secure", "port", "identity_file", "separator",
-			"inet4_only", "inet6_only", "ipport" ]
+			"inet4_only", "inet6_only", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
-	options = check_input(device_opt, process_input(device_opt))
+	all_opt["power_wait"]["default"] = "5"
+	all_opt["cmd_prompt"]["default"] = "system>"
 
-	## 
-	## Fence agent specific defaults
-	#####
-	if 0 == options.has_key("-c"):
-		options["-c"] = "system>"
+	options = check_input(device_opt, process_input(device_opt))
 
 	##
 	## Operate the fencing device
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 3ac5295..989ec5c 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -86,7 +86,8 @@ def main():
 		       "test", "port", "separator", "no_login", "no_password",
 		       "snmp_version", "community", "snmp_auth_prot", "snmp_sec_level",
 		       "snmp_priv_prot", "snmp_priv_passwd", "snmp_priv_passwd_script",
-		       "udpport","inet4_only","inet6_only"]
+		       "udpport","inet4_only","inet6_only",
+		       "power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index bc09805..c3e1045 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -29,7 +29,7 @@ def get_power_status(conn, options):
 		elif options["model"] == "DRAC 5":
 			conn.sendline("racadm serveraction powerstatus")
 		
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -52,7 +52,7 @@ def set_power_status(conn, options):
 			conn.sendline("racadm serveraction " + action + " -m " + options["-m"])
 		elif options["model"] == "DRAC 5":
 			conn.sendline("racadm serveraction " + action)
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-g"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -69,7 +69,7 @@ def get_list_devices(conn, options):
 			for line in conn.before.splitlines():
 				if (list_re.search(line)):
 					outlets[list_re.search(line).group(1)] = ("", list_re.search(line).group(2))
-			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-g"]))
 		elif options["model"] == "DRAC 5":
 			## DRAC 5 can be used only for one computer
 			pass
@@ -84,7 +84,8 @@ def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
 			"cmd_prompt", "secure", "drac_version", "module_name",
-			"separator", "inet4_only", "inet6_only", "ipport" ]
+			"separator", "inet4_only", "inet6_only", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 828e95c..e67f645 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -28,7 +28,7 @@ def get_power_status(conn, options):
 		" PASSWORD = \"" + options["-p"] + "\">\r\n")
 	conn.send("<SERVER_INFO MODE = \"read\"><GET_HOST_POWER_STATUS/>\r\n")
 	conn.send("</SERVER_INFO></LOGIN>\r\n")
-	conn.log_expect(options, "HOST_POWER=\"(.*?)\"", POWER_TIMEOUT)
+	conn.log_expect(options, "HOST_POWER=\"(.*?)\"", int(options["-g"]))
 
 	status = conn.match.group(1)
 	return status.lower().strip()
@@ -57,10 +57,13 @@ def set_power_status(conn, options):
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"ssl", "ribcl", "inet4_only", "inet6_only", "ipport" ]
+			"ssl", "ribcl", "inet4_only", "inet6_only", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
+	all_opt["login_timeout"]["default"] = "10"
+
 	pinput = process_input(device_opt)
 	pinput["-z"] = 1
 	options = check_input(device_opt, pinput)
@@ -73,7 +76,7 @@ def main():
 	conn = fence_login(options)
 	try:
 		conn.send("<?xml version=\"1.0\"?>\r\n")
-		conn.log_expect(options, [ "</RIBCL>", "<END_RIBCL/>" ], LOGIN_TIMEOUT)
+		conn.log_expect(options, [ "</RIBCL>", "<END_RIBCL/>" ], int(options["-y"]))
 		version = re.compile("<RIBCL VERSION=\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1)
 		if options.has_key("-r") == 0:
 			options["-r"] = float(version)
@@ -88,8 +91,8 @@ def main():
 		if options["-r"] >= 2:
 			conn.send("<RIB_INFO MODE=\"read\"><GET_FW_VERSION />\r\n")
 			conn.send("</RIB_INFO>\r\n")
-			conn.log_expect(options, "<GET_FW_VERSION\s*\n", SHELL_TIMEOUT)
-			conn.log_expect(options, "/>", SHELL_TIMEOUT)
+			conn.log_expect(options, "<GET_FW_VERSION\s*\n", int(options["-Y"]))
+			conn.log_expect(options, "/>", int(options["-Y"]))
 			options["fw_version"] = float(re.compile("FIRMWARE_VERSION\s*=\s*\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1))
 			options["fw_processor"] = re.compile("MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1)
 		conn.send("</LOGIN>\r\n")
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 471e7e2..b870e4b 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -16,10 +16,6 @@ REDHAT_COPYRIGHT=""
 BUILD_DATE=""
 #END_VERSION_GENERATION
 
-POWER_TIMEOUT = 20
-SHELL_TIMEOUT = 3
-LOGIN_TIMEOUT = 5
-
 LOG_MODE_VERBOSE = 100
 LOG_MODE_QUIET = 0
 
@@ -246,8 +242,36 @@ all_opt = {
 		"order" : 1},
 	"separator" : {
 		"getopt" : "C:",
-		"help" : "-C <char>	Separator for CSV created by 'list' operation",
-		"order" : 100 }
+		"longopt" : "separator",
+		"help" : "-C, --separator=<char>         Separator for CSV created by 'list' operation",
+		"default" : ",", 
+		"required" : "0",
+		"shortdesc" : "Separator for CSV created by operation list",
+		"order" : 100 },
+	"login_timeout" : {
+		"getopt" : "y:",
+		"longopt" : "login-timeout",
+		"help" : "--login-timeout <seconds>      Wait X seconds for cmd prompt after login",
+		"default" : "5", 
+		"order" : 200 },
+	"shell_timeout" : {
+		"getopt" : "Y:",
+		"longopt" : "shell-timeout",
+		"help" : "--shell-timeout <seconds>      Wait X seconds for cmd prompt after issuing command",
+		"default" : "3", 
+		"order" : 200 },
+	"power_timeout" : {
+		"getopt" : "g:",
+		"longopt" : "power-timeout",
+		"help" : "--power-timeout <seconds>      Test X seconds for status change after ON/OFF",
+		"default" : "20", 
+		"order" : 200 },
+	"power_wait" : {
+		"getopt" : "G:",
+		"longopt" : "power-wait",
+		"help" : "--power-wait <seconds>         Wait X seconds after issuing ON/OFF",
+		"default" : "0", 
+		"order" : 200 }
 }
 
 class fspawn(pexpect.spawn):
@@ -500,7 +524,7 @@ def check_input(device_opt, opt):
 	return options
 	
 def wait_power_status(tn, options, get_power_fn):
-	for dummy in xrange(POWER_TIMEOUT):
+	for dummy in xrange(int(options["-g"])):
 		if get_power_fn(tn, options) != options["-o"]:
 			time.sleep(1)
 		else:
@@ -542,6 +566,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 			print "Success: Already ON"
 		else:
 			set_power_fn(tn, options)
+			time.sleep(int(options["-G"]))
 			if wait_power_status(tn, options, get_power_fn):
 				print "Success: Powered ON"
 			else:
@@ -551,6 +576,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 			print "Success: Already OFF"
 		else:
 			set_power_fn(tn, options)
+			time.sleep(int(options["-G"]))
 			if wait_power_status(tn, options, get_power_fn):
 				print "Success: Powered OFF"
 			else:
@@ -559,10 +585,12 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 		if status != "off":
 			options["-o"] = "off"
 			set_power_fn(tn, options)
+			time.sleep(int(options["-G"]))
 			if wait_power_status(tn, options, get_power_fn) == 0:
 				fail(EC_WAITING_OFF)
 		options["-o"] = "on"
 		set_power_fn(tn, options)
+		time.sleep(int(options["-G"]))
 		if wait_power_status(tn, options, get_power_fn) == 0:
 			sys.stderr.write('Timed out waiting to power ON\n')
 		print "Success: Rebooted"
@@ -596,38 +624,64 @@ def fence_login(options):
 			command = '%s %s %s@%s -p %s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"], options["-u"])
 			if options.has_key("ssh_options"):
 				command += ' ' + options["ssh_options"]
-			conn = fspawn(command)
-			result = conn.log_expect(options, [ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT)
-			if result == 1:
-				conn.sendline("yes")
-				conn.log_expect(options, "ssword:", LOGIN_TIMEOUT)
+
+			try:
+				conn = fspawn(command)
+			except pexpect.ExceptionPexpect, ex:
+				sys.stderr.write(str(ex) + "\n")
+				sys.stderr.write("Due to limitations, binary dependencies on fence agents "
+				"are not in the spec file and must be installed separately." + "\n")
+				sys.exit(EC_GENERIC_ERROR)
+				
+			if options.has_key("telnet_over_ssh"):
+				#This is for stupid ssh servers (like ALOM) which behave more like telnet (ignore name and display login prompt)
+				result = conn.log_expect(options, [ re_login, "Are you sure you want to continue connecting (yes/no)?" ], int(options["-y"]))
+				if result == 1:
+					conn.sendline("yes") # Host identity confirm
+					conn.log_expect(options, re_login, int(options["-y"]))
+
+				conn.sendline(options["-l"])
+				conn.log_expect(options, re_pass, int(options["-y"]))
+			else:
+				result = conn.log_expect(options, [ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ], int(options["-y"]))
+				if result == 1:
+					conn.sendline("yes")
+					conn.log_expect(options, "ssword:", int(options["-y"]))
+
 			conn.sendline(options["-p"])
-			conn.log_expect(options, options["-c"], LOGIN_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-y"]))
 		elif options.has_key("-x") and 1 == options.has_key("-k"):
 			command = '%s %s %s@%s -i %s -p %s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"], options["-k"], options["-u"])
 			if options.has_key("ssh_options"):
 				command += ' ' + options["ssh_options"]
 			conn = fspawn(command)
 
-			result = conn.log_expect(options, [ options["-c"], "Are you sure you want to continue connecting (yes/no)?", "Enter passphrase for key '"+options["-k"]+"':" ], LOGIN_TIMEOUT)
+			result = conn.log_expect(options, [ options["-c"], "Are you sure you want to continue connecting (yes/no)?", "Enter passphrase for key '"+options["-k"]+"':" ], int(options["-y"]))
 			if result == 1:
 				conn.sendline("yes")
-				conn.log_expect(options, [ options["-c"], "Enter passphrase for key '"+options["-k"]+"':"] , LOGIN_TIMEOUT)
+				conn.log_expect(options, [ options["-c"], "Enter passphrase for key '"+options["-k"]+"':"] , int(options["-y"]))
 			if result != 0:
 				if options.has_key("-p"):
 					conn.sendline(options["-p"])
-					conn.log_expect(options, options["-c"], LOGIN_TIMEOUT)
+					conn.log_expect(options, options["-c"], int(options["-y"]))
 				else:
 					fail_usage("Failed: You have to enter passphrase (-p) for identity file")
 		else:
-			conn = fspawn(TELNET_PATH)
-			conn.send("set binary\n")
-			conn.send("open %s -%s\n"%(options["-a"], options["-u"]))
-			conn.log_expect(options, re_login, LOGIN_TIMEOUT)
+			try:
+				conn = fspawn(TELNET_PATH)
+				conn.send("set binary\n")
+				conn.send("open %s -%s\n"%(options["-a"], options["-u"]))
+			except pexpect.ExceptionPexpect, ex:
+				sys.stderr.write(str(ex) + "\n")
+				sys.stderr.write("Due to limitations, binary dependencies on fence agents "
+				"are not in the spec file and must be installed separately." + "\n")
+				sys.exit(EC_GENERIC_ERROR)
+
+			conn.log_expect(options, re_login, int(options["-y"]))
 			conn.send(options["-l"] + login_eol)
-			conn.log_expect(options, re_pass, SHELL_TIMEOUT)
+			conn.log_expect(options, re_pass, int(options["-Y"]))
 			conn.send(options["-p"] + login_eol)
-			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_LOGIN_DENIED) 
 	except pexpect.TIMEOUT:
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 49e3c57..e3bfdc2 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -75,7 +75,7 @@ class FencingSnmp:
 		try:
 			self.log_command(command)
 
-			(res_output,res_code)=pexpect.run(command,SHELL_TIMEOUT+LOGIN_TIMEOUT+additional_timemout,True)
+			(res_output,res_code)=pexpect.run(command,int(options["-Y"])+int(options["-y"])+additional_timemout,True)
 
 			if (res_code==None):
 				fail(EC_TIMED_OUT)
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index b507b46..97241d3 100755
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -25,7 +25,7 @@ def get_power_status(conn, options):
 	if options["-H"] == "3":
 		try:
 			conn.send("lssyscfg -r lpar -m " + options["-s"] + " -n " + options["-n"] + " -F name,state\n")
-			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-g"]))
 		except pexpect.EOF:
 			fail(EC_CONNECTION_LOST)
 		except pexpect.TIMEOUT:
@@ -38,7 +38,7 @@ def get_power_status(conn, options):
 	elif options["-H"] == "4":
 		try:
 			conn.send("lssyscfg -r lpar -m "+ options["-s"] +" --filter 'lpar_names=" + options["-n"] + "'\n")
-			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-g"]))
 		except pexpect.EOF:
 			fail(EC_CONNECTION_LOST)
 		except pexpect.TIMEOUT:
@@ -63,7 +63,7 @@ def set_power_status(conn, options):
 		try:
 			conn.send("chsysstate -o " + options["-o"] + " -r lpar -m " + options["-s"]
 				+ " -n " + options["-n"] + "\n")
-			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-g"]))
 		except pexpect.EOF:
 			fail(EC_CONNECTION_LOST)
 		except pexpect.TIMEOUT:
@@ -79,7 +79,7 @@ def set_power_status(conn, options):
 			else:
 				conn.send("chsysstate -o shutdown -r lpar --immed" +
 					" -m " + options["-s"] + " -n " + options["-n"] + "\n")		
-			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-g"]))
 		except pexpect.EOF:
 			fail(EC_CONNECTION_LOST)
 		except pexpect.TIMEOUT:
@@ -90,7 +90,7 @@ def get_lpar_list(conn, options):
 	if options["-H"] == "3":
 		try:
 			conn.send("query_partition_names -m " + options["-s"] + "\n")
-			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-g"]))
 
 			## We have to remove first 3 lines (command + header) and last line (part of new prompt)
 			####
@@ -110,7 +110,7 @@ def get_lpar_list(conn, options):
 		try:
 			conn.send("lssyscfg -r lpar -m " + options["-s"] + 
 				" -F name:state\n")
-			conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+			conn.log_expect(options, options["-c"], int(options["-g"]))
 
 			## We have to remove first line (command) and last line (part of new prompt)
 			####
@@ -134,7 +134,8 @@ def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
 			"secure", "partition", "managed", "hmc_version", "cmd_prompt",
-			"separator", "inet4_only", "inet6_only", "ipport" ]
+			"separator", "inet4_only", "inet6_only", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 90cc99c..0a614a6 100755
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -20,7 +20,7 @@ BUILD_DATE="March, 2009"
 def get_power_status(conn, options):
 	try:
 		conn.send("power state\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -32,7 +32,7 @@ def get_power_status(conn, options):
 def set_power_status(conn, options):
 	try:
 		conn.send("power " + options["-o"] + "\r\n")
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-g"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -41,7 +41,8 @@ def set_power_status(conn, options):
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "secure", "ipport" ]
+			"cmd_prompt", "secure", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 54122a5..c792fc5 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -25,7 +25,7 @@ def get_power_status(conn, options):
 	}
 	try:
 		conn.send("show port " + options["-n"] + "\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -52,7 +52,7 @@ def set_power_status(conn, options):
 
         try:
         	conn.send("set port " + options["-n"] + " state " + action + "\n")
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-g"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -66,7 +66,7 @@ def set_power_status(conn, options):
 
 	try:
 		conn.send("set port " + options["-n"] + " state " + action + "\n")
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-g"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -83,7 +83,7 @@ def get_list_devices(conn, options):
 
 	try:
 		conn.send("show port" + "\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 
 		list_re = re.compile("^\s+(\d+?)\s+(Online|Offline)\s+", re.IGNORECASE)
 		for line in conn.before.splitlines():
@@ -110,7 +110,8 @@ def get_list_devices(conn, options):
 def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"io_fencing", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "port", "ipport", "login_eol_lf", "separator" ]
+			"cmd_prompt", "port", "ipport", "login_eol_lf", "separator",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
@@ -128,7 +129,7 @@ def main():
 	conn = fence_login(options)
 
 	conn.send("admin start\n")
-	conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+	conn.log_expect(options, options["-c"], int(options["-Y"]))
 
 	if (re.search("\(admin\)", conn.before, re.MULTILINE) == None):
 		## Someone else is in admin section, we can't enable/disable
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 3a102d2..ea2e06b 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -19,7 +19,7 @@ BUILD_DATE=""
 def get_outlets_status(conn, options):
 	try:
 		conn.sendline("virsh list --all")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -52,7 +52,7 @@ def set_power_status(conn, options):
 	try:
 		conn.sendline("virsh %s "%(options["-o"] == "on" and "start" or "destroy")+options["-n"])
 
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-g"]))
                 time.sleep(1)
 
 	except pexpect.EOF:
@@ -64,7 +64,8 @@ def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
 			"secure", "identity_file", "test", "port", "separator",
-			"inet4_only", "inet6_only", "ipport" ]
+			"inet4_only", "inet6_only", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index cb183dc..181a4b5 100755
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -25,7 +25,7 @@ BUILD_DATE=""
 def get_power_status(conn, options):
 	try:
 		conn.send("/S"+"\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-Y"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -67,7 +67,7 @@ def set_power_status(conn, options):
 
 	try:
 		conn.send(action + " " + options["-n"] + ",y\r\n")
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
+		conn.log_expect(options, options["-c"], int(options["-g"]))
 	except pexpect.EOF:
 		fail(EC_CONNECTION_LOST)
 	except pexpect.TIMEOUT:
@@ -77,7 +77,8 @@ def main():
 	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
 			"action", "ipaddr", "login", "passwd", "passwd_script",
 			"cmd_prompt", "secure", "port", "no_login", "no_password",
-			"test", "separator", "inet4_only", "inet6_only", "ipport" ]
+			"test", "separator", "inet4_only", "inet6_only", "ipport",
+			"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
 
 	atexit.register(atexit_handler)
 
@@ -100,18 +101,18 @@ def main():
 			re_login = re.compile("(login: )|(Login Name:  )|(username: )|(User Name :)", re.IGNORECASE)
 			re_prompt = re.compile("|".join(map (lambda x: "(" + x + ")", options["-c"])), re.IGNORECASE)
 
-			result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], SHELL_TIMEOUT)
+			result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], int(options["-Y"]))
 			if result == 0:
 				if options.has_key("-l"):
 					conn.send(options["-l"]+"\r\n")
-					result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], SHELL_TIMEOUT)
+					result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], int(options["-Y"]))
 				else:
 					fail_usage("Failed: You have to set login name")
 		
 			if result == 1:
 				if options.has_key("-p"):
 					conn.send(options["-p"]+"\r\n")
-					conn.log_expect(options, options["-c"], SHELL_TIMEOUT)	
+					conn.log_expect(options, options["-c"], int(options["-Y"]))	
 				else:
 					fail_usage("Failed: You have to enter password or password script")
 		except pexpect.EOF: