[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 1/3] fence agents: Transfer non-SNMP fence agents to long-opts



---
 fence/agents/alom/fence_alom.py               |    8 ++--
 fence/agents/apc/fence_apc.py                 |   70 ++++++++++++------------
 fence/agents/bladecenter/fence_bladecenter.py |   30 +++++-----
 fence/agents/cisco_ucs/fence_cisco_ucs.py     |   18 +++---
 fence/agents/drac5/fence_drac5.py             |   14 +++---
 fence/agents/hpblade/fence_hpblade.py         |   18 +++---
 fence/agents/ilo/fence_ilo.py                 |   34 ++++++------
 fence/agents/ilo_mp/fence_ilo_mp.py           |    6 +-
 fence/agents/ldom/fence_ldom.py               |   16 +++---
 fence/agents/lpar/fence_lpar.py               |   56 ++++++++++----------
 fence/agents/rhevm/fence_rhevm.py             |    4 +-
 fence/agents/rsa/fence_rsa.py                 |    6 +-
 fence/agents/rsb/fence_rsb.py                 |   18 +++---
 fence/agents/sanbox2/fence_sanbox2.py         |   18 +++---
 fence/agents/virsh/fence_virsh.py             |   10 ++--
 fence/agents/vmware/fence_vmware.py           |   70 ++++++++++++------------
 fence/agents/vmware_soap/fence_vmware_soap.py |   26 +++++-----
 fence/agents/wti/fence_wti.py                 |   40 +++++++-------
 18 files changed, 231 insertions(+), 231 deletions(-)

diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 3f39b2d..abe0a1a 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -17,18 +17,18 @@ BUILD_DATE=""
 
 def get_power_status(conn, options):
 	conn.send_eol("showplatform")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	status = re.search("standby", conn.before.lower())
 	result = (status != None and "off" or "on")
 
 	return result
 
 def set_power_status(conn, options):
-	cmd_line = (options["-o"] == "on" and "poweron" or "poweroff -f -y")
+	cmd_line = (options["--action"] == "on" and "poweron" or "poweroff -f -y")
 	conn.send_eol(cmd_line)
-	conn.log_expect(options, options["-c"], int(options["-g"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	# Get the machine some time between poweron and poweroff
-	time.sleep(int(options["-g"]))
+	time.sleep(int(options["--power-timeout"]))
 		
 def main():
 	device_opt = [  "ipaddr", "login", "passwd", "passwd_script", "cmd_prompt", "secure",
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 743627a..9236a30 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -29,7 +29,7 @@ def get_power_status(conn, options):
 	outlets = {}
 
 	conn.send_eol("1")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	version = 0
 	admin = 0
@@ -38,11 +38,11 @@ def get_power_status(conn, options):
 	if (None != re.compile('.* MasterSwitch plus.*', re.IGNORECASE | re.S).match(conn.before)):
 		switch = 1
 		if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)):
-			if (0 == options.has_key("-s")):
+			if (0 == options.has_key("--switch")):
 				fail_usage("Failed: You have to enter physical switch number")
 		else:
-			if (0 == options.has_key("-s")):
-				options["-s"] = "1"
+			if (0 == options.has_key("--switch")):
+				options["--switch"] = "1"
 
 	if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)):
 		version = 2
@@ -62,13 +62,13 @@ def get_power_status(conn, options):
 				conn.send_eol("3")
 		else:
 			conn.send_eol("2")
-			conn.log_expect(options, options["-c"], int(options["-Y"]))
+			conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 			conn.send_eol("1")
 	else:
-		conn.send_eol(options["-s"])
+		conn.send_eol(options["--switch"])
 			
 	while True:
-		exp_result = conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], int(options["-Y"]))
+		exp_result = conn.log_expect(options, [ options["--command-prompt"],  "Press <ENTER>" ], int(options["--shell-timeout"]))
 		lines = conn.before.split("\n")
 		show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
 		for x in lines:
@@ -79,14 +79,14 @@ def get_power_status(conn, options):
 		if exp_result == 0:
 			break
 	conn.send(chr(03))		
-	conn.log_expect(options, "- Logout", int(options["-Y"]))
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, "- Logout", int(options["--shell-timeout"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
-	if ["list", "monitor"].count(options["-o"]) == 1:
+	if ["list", "monitor"].count(options["--action"]) == 1:
 		return outlets
 	else:
 		try:
-			(_, status) = outlets[options["-n"]]
+			(_, status) = outlets[options["--plug"]]
 			return status.lower().strip()
 		except KeyError:
 			fail(EC_STATUS)
@@ -95,10 +95,10 @@ def set_power_status(conn, options):
 	action = {
 		'on' : "1",
 		'off': "2"
-	}[options["-o"]]
+	}[options["--action"]]
 
 	conn.send_eol("1")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	version = 0
 	admin2 = 0
@@ -111,13 +111,13 @@ def set_power_status(conn, options):
 		action = {
 			'on' : "1",
 			'off': "3"
-		}[options["-o"]]
+		}[options["--action"]]
 		if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)):
-			if (0 == options.has_key("-s")):
+			if (0 == options.has_key("--switch")):
 				fail_usage("Failed: You have to enter physical switch number")
 		else:
-			if (0 == options.has_key("-s")):
-				options["-s"] = 1
+			if (0 == options.has_key("--switch")):
+				options["--switch"] = 1
 
 	if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)):
 		version = 2
@@ -137,41 +137,41 @@ def set_power_status(conn, options):
 				conn.send_eol("3")
 		else:
 			conn.send_eol("2")
-			conn.log_expect(options, options["-c"], int(options["-Y"]))
+			conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 			if (None == re.compile('.*2- Outlet Restriction.*', re.IGNORECASE | re.S).match(conn.before)):
 				admin3 = 0
 			else:
 				admin3 = 1
 			conn.send_eol("1")
 	else:
-		conn.send_eol(options["-s"])
+		conn.send_eol(options["--switch"])
 
-	while 1 == conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], int(options["-Y"])):
+	while 1 == conn.log_expect(options, [ options["--command-prompt"],  "Press <ENTER>" ], int(options["--shell-timeout"])):
 		conn.send_eol("")
 
-	conn.send_eol(options["-n"]+"")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.send_eol(options["--plug"]+"")
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	if switch == 0:
 		if admin2 == 1:
 			conn.send_eol("1")
-			conn.log_expect(options, options["-c"], int(options["-Y"]))
+			conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 		if admin3 == 1:
 			conn.send_eol("1")
-			conn.log_expect(options, options["-c"], int(options["-Y"]))
+			conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	else:
 		conn.send_eol("1")
-		conn.log_expect(options, options["-c"], int(options["-Y"]))
+		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 		
 	conn.send_eol(action)
-	conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", int(options["-Y"]))
+	conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", int(options["--shell-timeout"]))
 	conn.send_eol("YES")
-	conn.log_expect(options, "Press <ENTER> to continue...", int(options["-Y"]))
+	conn.log_expect(options, "Press <ENTER> to continue...", int(options["--shell-timeout"]))
 	conn.send_eol("")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	conn.send(chr(03))
-	conn.log_expect(options, "- Logout", int(options["-Y"]))
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, "- Logout", int(options["--shell-timeout"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 def main():
 	device_opt = [  "ipaddr", "login", "passwd", "passwd_script", "cmd_prompt",
@@ -195,11 +195,11 @@ will block any necessary fencing actions."
 	docs["vendorurl"] = "http://www.apc.com";
 	show_docs(options, docs)
 
-	## Support for -n [switch]:[plug] notation that was used before
-	if (options.has_key("-n") == 1) and (-1 != options["-n"].find(":")):
-		(switch, plug) = options["-n"].split(":", 1)
-		options["-s"] = switch
-		options["-n"] = plug
+	## Support for --plug [switch]:[plug] notation that was used before
+	if (options.has_key("--plug") == 1) and (-1 != options["--plug"].find(":")):
+		(switch, plug) = options["--plug"].split(":", 1)
+		options["--switch"] = switch
+		options["--plug"] = plug
 
 	##
 	## Operate the fencing device
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 726a15f..cf38e10 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -23,40 +23,40 @@ BUILD_DATE="March, 2008"
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
-	node_cmd = "system:blade\[" + options["-n"] + "\]>"
+	node_cmd = "system:blade\[" + options["--plug"] + "\]>"
 
-	conn.send_eol("env -T system:blade[" + options["-n"] + "]")
-	i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["-Y"]))
+	conn.send_eol("env -T system:blade[" + options["--plug"] + "]")
+	i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["--shell-timeout"]))
 	if i == 1:
 		## Given blade number does not exist
-		if options.has_key("-M"):
+		if options.has_key("--missing-as-off"):
 			return "off"
 		else:
 			fail(EC_STATUS)
 	conn.send_eol("power -state")
-	conn.log_expect(options, node_cmd, int(options["-Y"]))
+	conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
 	status = conn.before.splitlines()[-1]
 	conn.send_eol("env -T system")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	return status.lower().strip()
 
 def set_power_status(conn, options):
-	node_cmd = "system:blade\[" + options["-n"] + "\]>"
+	node_cmd = "system:blade\[" + options["--plug"] + "\]>"
 
-	conn.send_eol("env -T system:blade[" + options["-n"] + "]")
-	i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["-Y"]))
+	conn.send_eol("env -T system:blade[" + options["--plug"] + "]")
+	i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["--shell-timeout"]))
 	if i == 1:
 		## Given blade number does not exist
-		if options.has_key("-M"):
+		if options.has_key("--missing-as-off"):
 			return
 		else:
 			fail(EC_GENERIC_ERROR)
 
-	conn.send_eol("power -"+options["-o"])
-	conn.log_expect(options, node_cmd, int(options["-Y"]))
+	conn.send_eol("power -"+options["--action"])
+	conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
 	conn.send_eol("env -T system")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 def get_blades_list(conn, options):
 	outlets = { }
@@ -64,9 +64,9 @@ def get_blades_list(conn, options):
 	node_cmd = "system>"
 
 	conn.send_eol("env -T system")
-	conn.log_expect(options, node_cmd, int(options["-Y"]))
+	conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
 	conn.send_eol("list -l 2")
-	conn.log_expect(options, node_cmd, int(options["-Y"]))
+	conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
 
 	lines = conn.before.split("\r\n")
 	filter_re = re.compile("^\s*blade\[(\d+)\]\s+(.*?)\s*$")
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 5ed2c35..2a81c68 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -19,8 +19,8 @@ RE_GET_DESC = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
 def get_power_status(conn, options):
 	res = send_command(options, \
 		"<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root" + options["-s"] + \
-		"/ls-" + options["-n"] + "/power\"/>", \
-		 int(options["-Y"]))
+		"/ls-" + options["--plug"] + "/power\"/>", \
+		 int(options["--shell-timeout"]))
 
 	result = RE_STATUS.search(res)
 	if (result == None):
@@ -37,14 +37,14 @@ def set_power_status(conn, options):
 	action = {
 		'on' : "up",
 		'off' : "down"
-	}[options["-o"]]
+	}[options["--action"]]
 	
 	res = send_command(options, \
 		"<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\">" + \
-		"<inConfigs><pair key=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\">" + \
-		"<lsPower dn=\"org-root/ls-" + options["-n"] + "/power\" state=\"" + action + "\" status=\"modified\" />" + \
+		"<inConfigs><pair key=\"org-root" + options["-s"] + "/ls-" + options["--plug"] + "/power\">" + \
+		"<lsPower dn=\"org-root/ls-" + options["--plug"] + "/power\" state=\"" + action + "\" status=\"modified\" />" + \
 		"</pair></inConfigs></configConfMos>", \
-		int(options["-Y"]))
+		int(options["--shell-timeout"]))
 	
 	return
 
@@ -54,7 +54,7 @@ def get_list(conn, options):
 	try:
 		res = send_command(options, \
 			"<configResolveClass cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" classId=\"lsServer\"/>", \
-			int(options["-Y"]))
+			int(options["--shell-timeout"]))
 
 		lines = res.split("<lsServer ")
 		for i in range(1, len(lines)):
@@ -113,7 +113,7 @@ used with Cisco UCS to fence machines."
 	show_docs(options, docs)
 
 	### Login
-	res = send_command(options, "<aaaLogin inName=\"" + options["-l"] + "\" inPassword=\"" + options["-p"] + "\" />", int(options["-y"]))
+	res = send_command(options, "<aaaLogin inName=\"" + options["--username"] + "\" inPassword=\"" + options["--password"] + "\" />", int(options["--login-timeout"]))
 	result = RE_COOKIE.search(res)
 	if (result == None):	
 		## Cookie is absenting in response
@@ -135,7 +135,7 @@ used with Cisco UCS to fence machines."
 	result = fence_action(None, options, set_power_status, get_power_status, get_list)
 
 	### Logout; we do not care about result as we will end in any case
-	send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />", int(options["-Y"]))
+	send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />", int(options["--shell-timeout"]))
 	
 	sys.exit(result)
 
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index f8c129d..bce8cef 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -24,11 +24,11 @@ BUILD_DATE="March, 2008"
 
 def get_power_status(conn, options):
 	if options["model"] == "DRAC CMC":
-		conn.send_eol("racadm serveraction powerstatus -m " + options["-m"])
+		conn.send_eol("racadm serveraction powerstatus -m " + options["--module-name"])
 	elif options["model"] == "DRAC 5":
 		conn.send_eol("racadm serveraction powerstatus")
 		
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 				
 	status = re.compile("(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
 	if status.lower().strip() in ["on", "powering on", "powering off"]:
@@ -40,13 +40,13 @@ def set_power_status(conn, options):
 	action = {
 		'on' : "powerup",
 		'off': "powerdown"
-	}[options["-o"]]
+	}[options["--action"]]
 
 	if options["model"] == "DRAC CMC":
-		conn.send_eol("racadm serveraction " + action + " -m " + options["-m"])
+		conn.send_eol("racadm serveraction " + action + " -m " + options["--module-name"])
 	elif options["model"] == "DRAC 5":
 		conn.send_eol("racadm serveraction " + action)
-	conn.log_expect(options, options["-c"], int(options["-g"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 def get_list_devices(conn, options):
 	outlets = { }
@@ -55,7 +55,7 @@ def get_list_devices(conn, options):
 		conn.send_eol("getmodinfo")
 
 		list_re = re.compile("^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$")
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 		for line in conn.before.splitlines():
 			if (list_re.search(line)):
 				outlets[list_re.search(line).group(1)] = ("", list_re.search(line).group(2))
@@ -95,7 +95,7 @@ By default, the telnet interface is not  enabled."
 	conn = fence_login(options)
 
 	if conn.before.find("CMC") >= 0:
-		if 0 == options.has_key("-m") and 0 == ["monitor", "list"].count(options["-o"].lower()):
+		if 0 == options.has_key("--module-name") and 0 == ["monitor", "list"].count(options["--action"].lower()):
 			fail_usage("Failed: You have to enter module name (-m)")
 			
 		options["model"] = "DRAC CMC"
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index c4f045e..6532065 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -17,8 +17,8 @@ BUILD_DATE="March, 2008"
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
-	conn.send_eol("show server status " + options["-n"])
-	conn.log_expect(options, options["-c"] , int(options["-Y"]))
+	conn.send_eol("show server status " + options["--plug"])
+	conn.log_expect(options, options["--command-prompt"] , int(options["--shell-timeout"]))
 		
 	power_re = re.compile("^\s*Power: (.*?)\s*$")
 	status = "unknown"
@@ -28,7 +28,7 @@ def get_power_status(conn, options):
 			status = res.group(1)
 
 	if status == "unknown":
-		if options.has_key("-M"):
+		if options.has_key("--missing-as-off"):
 			return "off"
 		else:
 			fail(EC_STATUS)
@@ -36,17 +36,17 @@ def get_power_status(conn, options):
 	return status.lower().strip()
 
 def set_power_status(conn, options):
-	if options["-o"] == "on":
-		conn.send_eol("poweron server " + options["-n"])
-	elif options["-o"] == "off":
-		conn.send_eol("poweroff server " + options["-n"] + " force")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	if options["--action"] == "on":
+		conn.send_eol("poweron server " + options["--plug"])
+	elif options["--action"] == "off":
+		conn.send_eol("poweroff server " + options["--plug"] + " force")
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 def get_blades_list(conn, options):
 	outlets = { }
 
 	conn.send_eol("show server list" )
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	list_re = re.compile("^\s*(.*?)\s+(.*?)\s+(.*?)\s+OK\s+(.*?)\s+(.*?)\s*$")
 	for line in conn.before.splitlines():
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 66472aa..c85a063 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -22,18 +22,18 @@ BUILD_DATE="March, 2008"
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
-	conn.send("<LOGIN USER_LOGIN = \"" + options["-l"] + "\"" + \
-		" PASSWORD = \"" + options["-p"] + "\">\r\n")
+	conn.send("<LOGIN USER_LOGIN = \"" + options["--username"] + "\"" + \
+		" PASSWORD = \"" + options["--password"] + "\">\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=\"(.*?)\"", int(options["-g"]))
+	conn.log_expect(options, "HOST_POWER=\"(.*?)\"", int(options["--power-timeout"]))
 
 	status = conn.match.group(1)
 	return status.lower().strip()
 
 def set_power_status(conn, options):
-	conn.send("<LOGIN USER_LOGIN = \"" + options["-l"] + "\"" + \
-		" PASSWORD = \"" + options["-p"] + "\">\r\n")
+	conn.send("<LOGIN USER_LOGIN = \"" + options["--username"] + "\"" + \
+		" PASSWORD = \"" + options["--password"] + "\">\r\n")
 	conn.send("<SERVER_INFO MODE = \"write\">")
 
 	if options.has_key("fw_processor") and options["fw_processor"] == "iLO2":
@@ -41,10 +41,10 @@ def set_power_status(conn, options):
 			conn.send("<HOLD_PWR_BTN TOGGLE=\"yes\" />\r\n")
 		else:
 			conn.send("<HOLD_PWR_BTN />\r\n")
-	elif options["-r"] < 2.21:
-		conn.send("<SET_HOST_POWER HOST_POWER = \"" + options["-o"] + "\" />\r\n")
+	elif options["--ribcl-version"] < 2.21:
+		conn.send("<SET_HOST_POWER HOST_POWER = \"" + options["--action"] + "\" />\r\n")
 	else:
-		if options["-o"] == "off":
+		if options["--action"] == "off":
 			conn.send("<HOLD_PWR_BTN/>\r\n")
 		else:
 			conn.send("<PRESS_PWR_BTN/>\r\n")
@@ -81,23 +81,23 @@ the iLO card through an XML stream."
 	conn = fence_login(options)
 	try:
 		conn.send("<?xml version=\"1.0\"?>\r\n")
-		conn.log_expect(options, [ "</RIBCL>", "<END_RIBCL/>" ], int(options["-y"]))
+		conn.log_expect(options, [ "</RIBCL>", "<END_RIBCL/>" ], int(options["--login-timeout"]))
 		version = re.compile("<RIBCL VERSION=\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1)
-		if options.has_key("-r") == 0:
-			options["-r"] = float(version)
+		if options.has_key("--ribcl-version") == 0:
+			options["--ribcl-version"] = float(version)
 
-		if options["-r"] >= 2:
+		if options["--ribcl-version"] >= 2:
 			conn.send("<RIBCL VERSION=\"2.0\">\r\n")
 		else:
 			conn.send("<RIBCL VERSION=\"1.2\">\r\n")
 
-		conn.send("<LOGIN USER_LOGIN = \"" + options["-l"] + "\"" + \
-			" PASSWORD = \"" + options["-p"] + "\">\r\n")
-		if options["-r"] >= 2:
+		conn.send("<LOGIN USER_LOGIN = \"" + options["--username"] + "\"" + \
+			" PASSWORD = \"" + options["--password"] + "\">\r\n")
+		if options["--ribcl-version"] >= 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", int(options["-Y"]))
-			conn.log_expect(options, "/>", int(options["-Y"]))
+			conn.log_expect(options, "<GET_FW_VERSION\s*\n", int(options["--shell-timeout"]))
+			conn.log_expect(options, "/>", int(options["--shell-timeout"]))
 			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/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index 7cf068a..85764c6 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -14,7 +14,7 @@ def get_power_status(conn, options):
 	conn.send_eol("show /system1")
 		
 	re_state = re.compile('EnabledState=(.*)', re.IGNORECASE)
-	conn.log_expect(options, re_state, int(options["-Y"]))
+	conn.log_expect(options, re_state, int(options["--shell-timeout"]))
 
 	status = conn.match.group(1).lower()
 
@@ -24,12 +24,12 @@ def get_power_status(conn, options):
 		return "off"
 
 def set_power_status(conn, options):
-	if options["-o"] == "on":
+	if options["--action"] == "on":
 		conn.send_eol("start /system1")
 	else:
 		conn.send_eol("stop -f /system1")
 
-	conn.log_expect(options, options["-c"], int(options["-g"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 	return
 
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index 0d67e3f..0f41d75 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -23,11 +23,11 @@ COMMAND_PROMPT_NEW = "[PEXPECT]"
 # Start comunicating after login. Prepare good environment.
 def start_communication(conn, options):
 	conn.send_eol ("PS1='"+COMMAND_PROMPT_NEW+"'")
-	res = conn.expect([pexpect.TIMEOUT, COMMAND_PROMPT_REG], int(options["-Y"]))
+	res = conn.expect([pexpect.TIMEOUT, COMMAND_PROMPT_REG], int(options["--shell-timeout"]))
 	if res == 0:
 		#CSH stuff
 		conn.send_eol("set prompt='"+COMMAND_PROMPT_NEW+"'")
-		conn.log_expect(options, COMMAND_PROMPT_REG, int(options["-Y"]))
+		conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--shell-timeout"]))
 	
 
 def get_power_status(conn, options):
@@ -35,7 +35,7 @@ def get_power_status(conn, options):
 		
 	conn.send_eol("ldm ls")
 		    
-	conn.log_expect(options, COMMAND_PROMPT_REG, int(options["-Y"]))
+	conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--shell-timeout"]))
 
 	result = {}
 
@@ -51,22 +51,22 @@ def get_power_status(conn, options):
 			elif (fa_status==1):
 				result[domain.group(1)] = ("", (domain.group(2).lower()=="bound" and "off" or "on"))
 
-	if (not (options["-o"] in ['monitor','list'])):
-		if (not (options["-n"] in result)):
+	if (not (options["--action"] in ['monitor','list'])):
+		if (not (options["--plug"] in result)):
 			fail_usage("Failed: You have to enter existing logical domain!")
 		else:
-			return result[options["-n"]][1]
+			return result[options["--plug"]][1]
 	else:
 		return result
 
 def set_power_status(conn, options):
 	start_communication(conn, options)
          	
-	cmd_line = "ldm "+(options["-o"]=="on" and "start" or "stop -f")+" \""+options["-n"]+"\""
+	cmd_line = "ldm "+(options["--action"]=="on" and "start" or "stop -f")+" \""+options["--plug"]+"\""
             	
 	conn.send_eol(cmd_line)
 		    
-	conn.log_expect(options, COMMAND_PROMPT_REG, int(options["-g"]))
+	conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--power-timeout"]))
 		
 def main():
 	device_opt = [  "ipaddr", "login", "passwd", "passwd_script",
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 4522dfd..0bae359 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -21,17 +21,17 @@ BUILD_DATE=""
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
-	if options["-H"] == "3":
-		conn.send("lssyscfg -r lpar -m " + options["-s"] + " -n " + options["-n"] + " -F name,state\n")
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+	if options["--hmc-version"] == "3":
+		conn.send("lssyscfg -r lpar -m " + options["--managed"] + " -n " + options["--plug"] + " -F name,state\n")
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		try:
-			status = re.compile("^" + options["-n"] + ",(.*?),.*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
+			status = re.compile("^" + options["--plug"] + ",(.*?),.*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
 		except AttributeError:
 			fail(EC_STATUS_HMC)
-	elif options["-H"] == "4":
-		conn.send("lssyscfg -r lpar -m "+ options["-s"] +" --filter 'lpar_names=" + options["-n"] + "'\n")
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+	elif options["--hmc-version"] == "4":
+		conn.send("lssyscfg -r lpar -m "+ options["--managed"] +" --filter 'lpar_names=" + options["--plug"] + "'\n")
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		try:				
 			status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
@@ -48,27 +48,27 @@ def get_power_status(conn, options):
 	return status
 
 def set_power_status(conn, options):
-	if options["-H"] == "3":
-		conn.send("chsysstate -o " + options["-o"] + " -r lpar -m " + options["-s"]
-			+ " -n " + options["-n"] + "\n")
-		conn.log_expect(options, options["-c"], int(options["-g"]))
-	elif options["-H"] == "4":
-		if options["-o"] == "on":
-			conn.send("chsysstate -o on -r lpar -m " + options["-s"] + 
-				" -n " + options["-n"] + 
+	if options["--hmc-version"] == "3":
+		conn.send("chsysstate -o " + options["--action"] + " -r lpar -m " + options["--managed"]
+			+ " -n " + options["--plug"] + "\n")
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
+	elif options["--hmc-version"] == "4":
+		if options["--action"] == "on":
+			conn.send("chsysstate -o on -r lpar -m " + options["--managed"] + 
+				" -n " + options["--plug"] + 
 				" -f `lssyscfg -r lpar -F curr_profile " +
-				" -m " + options["-s"] +
-				" --filter \"lpar_names="+ options["-n"] +"\"`\n" )
+				" -m " + options["--managed"] +
+				" --filter \"lpar_names="+ options["--plug"] +"\"`\n" )
 		else:
 			conn.send("chsysstate -o shutdown -r lpar --immed" +
-				" -m " + options["-s"] + " -n " + options["-n"] + "\n")		
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+				" -m " + options["--managed"] + " -n " + options["--plug"] + "\n")		
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 def get_lpar_list(conn, options):
 	outlets = { }
-	if options["-H"] == "3":
-		conn.send("query_partition_names -m " + options["-s"] + "\n")
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+	if options["--hmc-version"] == "3":
+		conn.send("query_partition_names -m " + options["--managed"] + "\n")
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		## We have to remove first 3 lines (command + header) and last line (part of new prompt)
 		####
@@ -80,10 +80,10 @@ def get_lpar_list(conn, options):
 		lines = res.group(2).split("\n")
 		for outlet_line in lines:
 			outlets[outlet_line.rstrip()] = ("", "")
-	elif options["-H"] == "4":
-		conn.send("lssyscfg -r lpar -m " + options["-s"] + 
+	elif options["--hmc-version"] == "4":
+		conn.send("lssyscfg -r lpar -m " + options["--managed"] + 
 			" -F name:state\n")
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		## We have to remove first line (command) and last line (part of new prompt)
 		####
@@ -117,13 +117,13 @@ def main():
 	docs["longdesc"] = ""
 	show_docs(options, docs)
 
-	if 0 == options.has_key("-s"):
+	if 0 == options.has_key("--managed"):
 		fail_usage("Failed: You have to enter name of managed system")
 
-	if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n")):
+	if (0 == ["list", "monitor"].count(options["--action"].lower())) and (0 == options.has_key("--plug")):
 		fail_usage("Failed: You have to enter name of the partition")
 
-	if 1 == options.has_key("-H") and (options["-H"] != "3" and options["-H"] != "4"):
+	if 1 == options.has_key("--hmc-version") and (options["--hmc-version"] != "3" and options["--hmc-version"] != "4"):
 		fail_usage("Failed: You have to enter valid version number: 3 or 4")
 
 	##
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 7f5abde..fb97d51 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -18,7 +18,7 @@ RE_GET_NAME = re.compile("<name>(.*?)</name>", re.IGNORECASE)
 
 def get_power_status(conn, options):
 	### Obtain real ID from name
-	res = send_command(options, "vms/?search=name%3D" + options["-n"])
+	res = send_command(options, "vms/?search=name%3D" + options["--plug"])
 
 	result = RE_GET_ID.search(res)
 	if (result == None):
@@ -45,7 +45,7 @@ def set_power_status(conn, options):
 	action = {
 		'on' : "start",
 		'off' : "stop"
-	}[options["-o"]]
+	}[options["--action"]]
 
 	url = "vms/" + options["id"] + "/" + action
 	res = send_command(options, url, "POST")
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 75cf1f7..e1e303f 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -19,7 +19,7 @@ BUILD_DATE=""
 
 def get_power_status(conn, options):
 	conn.send_eol("power state")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 				
 	match = re.compile("Power: (.*)", re.IGNORECASE).search(conn.before)
 	if (match != None):
@@ -30,8 +30,8 @@ def get_power_status(conn, options):
 	return status.lower().strip()
 
 def set_power_status(conn, options):
-	conn.send_eol("power " + options["-o"])
-	conn.log_expect(options, options["-c"], int(options["-g"]))
+	conn.send_eol("power " + options["--action"])
+	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 def main():
 	device_opt = [  "ipaddr", "login", "passwd", "passwd_script",
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 40c922e..395a844 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -12,10 +12,10 @@ BUILD_DATE=""
 
 def get_power_status(conn, options):
 	conn.send("2")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	status = re.compile("Power Status : (on|off)", re.IGNORECASE).search(conn.before).group(1)
 	conn.send("0")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	return (status.lower().strip())
 
@@ -23,18 +23,18 @@ def set_power_status(conn, options):
 	action = {
 		'on' : "4",
 		'off': "1"
-	}[options["-o"]]
+	}[options["--action"]]
 
 	conn.send("2")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	conn.send_eol(action)
-	conn.log_expect(options, ["want to power off", "'yes' or 'no'"], int(options["-Y"]))
+	conn.log_expect(options, ["want to power off", "'yes' or 'no'"], int(options["--shell-timeout"]))
 	conn.send_eol("yes")
-	conn.log_expect(options, "any key to continue", int(options["-g"]))
+	conn.log_expect(options, "any key to continue", int(options["--power-timeout"]))
 	conn.send_eol("")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	conn.send_eol("0")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 def main():
 	device_opt = [  "ipaddr", "login", "passwd", "passwd_script",
@@ -59,7 +59,7 @@ def main():
 
 	# set default port for telnet only
 	if 0 == opt.has_key("-x") and 0 == opt.has_key("-u"):
-		opt["-u"] = 3172
+		opt["--ipport"] = 3172
 	options = check_input(device_opt, opt)
 
 	docs = { }
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 173c819..ccbfd8e 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -24,8 +24,8 @@ def get_power_status(conn, options):
 		'offline' : "off"
 	}
 	try:
-		conn.send_eol("show port " + options["-n"])
-		conn.log_expect(options, options["-c"], int(options["-Y"]))
+		conn.send_eol("show port " + options["--plug"])
+		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	except pexpect.TIMEOUT:
 		try:
 			conn.send_eol("admin end")
@@ -46,11 +46,11 @@ def set_power_status(conn, options):
 	action = {
 		'on' : "online",
 		'off' : "offline"
-	}[options["-o"]]
+	}[options["--action"]]
 
 	try:
-		conn.send_eol("set port " + options["-n"] + " state " + action)
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+		conn.send_eol("set port " + options["--plug"] + " state " + action)
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	except pexpect.TIMEOUT:
 		try:
 			conn.send_eol("admin end")
@@ -61,8 +61,8 @@ def set_power_status(conn, options):
 		fail(EC_TIMED_OUT)                                                                         	
 
 	try:
-		conn.send_eol("set port " + options["-n"] + " state " + action)
-		conn.log_expect(options, options["-c"], int(options["-g"]))
+		conn.send_eol("set port " + options["--plug"] + " state " + action)
+		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	except pexpect.TIMEOUT:
 		try:
 			conn.send_eol("admin end")
@@ -77,7 +77,7 @@ def get_list_devices(conn, options):
 
 	try:
 		conn.send_eol("show port")
-		conn.log_expect(options, options["-c"], int(options["-Y"]))
+		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 		list_re = re.compile("^\s+(\d+?)\s+(Online|Offline)\s+", re.IGNORECASE)
 		for line in conn.before.splitlines():
@@ -125,7 +125,7 @@ because the connection will block any necessary fencing actions."
 	conn = fence_login(options)
 
 	conn.send_eol("admin start")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	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 c8c49a4..b157385 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -22,7 +22,7 @@ def get_outlets_status(conn, options):
 		prefix = ""
 
 	conn.sendline(prefix + "virsh list --all")
-	conn.log_expect(options, options["-c"], int(options["-Y"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	result = {}
 
@@ -42,10 +42,10 @@ def get_outlets_status(conn, options):
 def get_power_status(conn, options):
 	outlets = get_outlets_status(conn, options)
 
-	if (not (options["-n"] in outlets)):
+	if (not (options["--plug"] in outlets)):
 		fail_usage("Failed: You have to enter existing name of virtual machine!")
 	else:
-		return outlets[options["-n"]][1]
+		return outlets[options["--plug"]][1]
 
 def set_power_status(conn, options):
 	if options.has_key("-d"):
@@ -53,9 +53,9 @@ def set_power_status(conn, options):
 	else:
 		prefix = ""
 
-	conn.sendline(prefix + "virsh %s "%(options["-o"] == "on" and "start" or "destroy")+options["-n"])
+	conn.sendline(prefix + "virsh %s "%(options["--action"] == "on" and "start" or "destroy")+options["--plug"])
 
-	conn.log_expect(options, options["-c"], int(options["-g"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	time.sleep(1)
 
 def main():
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 6e3f394..8524480 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -106,28 +106,28 @@ def quote_for_run(str):
 
 # Return string with command and additional parameters (something like vmrun -h 'host'
 def vmware_prepare_command(options, add_login_params, additional_params):
-	res = options["-e"]
+	res = options["--exec"]
 
 	if (add_login_params):
 		if (vmware_internal_type==VMWARE_TYPE_ESX):
-			res += " --server '%s' --username '%s' --password '%s' "% (quote_for_run(options["-a"]),
-										quote_for_run(options["-l"]),
-										quote_for_run(options["-p"]))
+			res += " --server '%s' --username '%s' --password '%s' "% (quote_for_run(options["--ip"]),
+										quote_for_run(options["--username"]),
+										quote_for_run(options["--password"]))
 		elif (vmware_internal_type==VMWARE_TYPE_SERVER2):
-			res += " -h 'https://%s/sdk' -u '%s' -p '%s' -T server "% (quote_for_run(options["-a"]),
-										quote_for_run(options["-l"]),
-										quote_for_run(options["-p"]))
+			res += " -h 'https://%s/sdk' -u '%s' -p '%s' -T server "% (quote_for_run(options["--ip"]),
+										quote_for_run(options["--username"]),
+										quote_for_run(options["--password"]))
 		elif (vmware_internal_type==VMWARE_TYPE_SERVER1):
-			host_name_array = options["-a"].split(':')
+			host_name_array = options["--ip"].split(':')
 
 			res += " -h '%s' -u '%s' -p '%s' -T server1 "% (quote_for_run(host_name_array[0]),
-								     quote_for_run(options["-l"]),
-								     quote_for_run(options["-p"]))
+								     quote_for_run(options["--username"]),
+								     quote_for_run(options["--password"]))
 			if (len(host_name_array)>1):
 				res += "-P '%s' "% (quote_for_run(host_name_array[1]))
 
-	if ((options.has_key("-s")) and (vmware_internal_type==VMWARE_TYPE_ESX)):
-		res += "--datacenter '%s' "% (quote_for_run(options["-s"]))
+	if ((options.has_key("--vmware-datacenter")) and (vmware_internal_type==VMWARE_TYPE_ESX)):
+		res += "--datacenter '%s' "% (quote_for_run(options["--vmware-datacenter"]))
 
 	if (additional_params != ""):
 		res += additional_params
@@ -148,18 +148,18 @@ def vmware_run_command(options, add_login_params, additional_params, additional_
 	try:
 		vmware_log(options, command)
 
-		(res_output, res_code) = pexpect.run(command, int(options["-Y"])+int(options["-y"])+additional_timeout, True)
+		(res_output, res_code) = pexpect.run(command, int(options["--shell-timeout"])+int(options["--login-timeout"])+additional_timeout, True)
 
 		if (res_code==None):
 			fail(EC_TIMED_OUT)
 		if ((res_code!=0) and (add_login_params)):
 			vmware_log(options, res_output)
-			fail_usage("%s returned %s"% (options["-e"], res_output))
+			fail_usage("%s returned %s"% (options["--exec"], res_output))
 		else:
 			vmware_log(options, res_output)
 
 	except pexpect.ExceptionPexpect:
-		fail_usage("Cannot run command %s"% (options["-e"]))
+		fail_usage("Cannot run command %s"% (options["--exec"]))
 
 	return res_output
 
@@ -169,9 +169,9 @@ def vmware_get_outlets_vi(conn, options, add_vm_name):
 	outlets = {}
 
 	if (add_vm_name):
-		all_machines = vmware_run_command(options, True, ("--operation status --vmname '%s'"% (quote_for_run(options["-n"]))), 0)
+		all_machines = vmware_run_command(options, True, ("--operation status --vmname '%s'"% (quote_for_run(options["--plug"]))), 0)
 	else:
-		all_machines = vmware_run_command(options, True, "--operation list", int(options["-g"]))
+		all_machines = vmware_run_command(options, True, "--operation list", int(options["--power-timeout"]))
 
 	all_machines_array = all_machines.splitlines()
 
@@ -222,22 +222,22 @@ def get_power_status(conn, options):
 		outlets = get_outlets_status(conn, options)
 
 	if ((vmware_internal_type==VMWARE_TYPE_SERVER2) or (vmware_internal_type==VMWARE_TYPE_ESX)):
-		if (not (options["-n"] in outlets)):
+		if (not (options["--plug"] in outlets)):
 			fail_usage("Failed: You have to enter existing name of virtual machine!")
 		else:
-			return outlets[options["-n"]][1]
+			return outlets[options["--plug"]][1]
 	elif (vmware_internal_type==VMWARE_TYPE_SERVER1):
-		return ((options["-n"] in outlets) and "on" or "off")
+		return ((options["--plug"] in outlets) and "on" or "off")
 
 def set_power_status(conn, options):
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
-		additional_params = "--operation %s --vmname '%s'"% ((options["-o"]=="on" and "on" or "off"), quote_for_run(options["-n"]))
+		additional_params = "--operation %s --vmname '%s'"% ((options["--action"]=="on" and "on" or "off"), quote_for_run(options["--plug"]))
 	elif ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
-		additional_params = "%s '%s'"% ((options["-o"]=="on" and "start" or "stop"), quote_for_run(options["-n"]))
-		if (options["-o"]=="off"):
+		additional_params = "%s '%s'"% ((options["--action"]=="on" and "start" or "stop"), quote_for_run(options["--plug"]))
+		if (options["--action"]=="off"):
 			additional_params += " hard"
 
-	vmware_run_command(options, True, additional_params, int(options["-g"]))
+	vmware_run_command(options, True, additional_params, int(options["--power-timeout"]))
 
 # Returns True, if user uses supported vmrun version (currently >=2.0.0) otherwise False.
 def vmware_is_supported_vmrun_version(options):
@@ -257,24 +257,24 @@ def vmware_is_supported_vmrun_version(options):
 	return True
 
 # Check vmware type, set vmware_internal_type to one of VMWARE_TYPE_ value and
-# options["-e"] to path (if not specified)
+# options["--exec"] to path (if not specified)
 def vmware_check_vmware_type(options):
 	global vmware_internal_type
 
-	options["-d"] = options["-d"].lower()
+	options["--vmware-type"] = options["--vmware-type"].lower()
 
-	if (options["-d"]=="esx"):
+	if (options["--vmware-type"]=="esx"):
 		vmware_internal_type = VMWARE_TYPE_ESX
-		if (not options.has_key("-e")):
-			options["-e"] = VMHELPER_COMMAND
-	elif (options["-d"]=="server2"):
+		if (not options.has_key("--exec")):
+			options["--exec"] = VMHELPER_COMMAND
+	elif (options["--vmware-type"]=="server2"):
 		vmware_internal_type = VMWARE_TYPE_SERVER2
-		if (not options.has_key("-e")):
-			options["-e"] = VMRUN_COMMAND
-	elif (options["-d"]=="server1"):
+		if (not options.has_key("--exec")):
+			options["--exec"] = VMRUN_COMMAND
+	elif (options["--vmware-type"]=="server1"):
 		vmware_internal_type = VMWARE_TYPE_SERVER1
-		if (not options.has_key("-e")):
-			options["-e"] = VMRUN_COMMAND
+		if (not options.has_key("--exec")):
+			options["--exec"] = VMRUN_COMMAND
 	else:
 		fail_usage("vmware_type can be esx,server2 or server1!")
 
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index 2710603..4ef03f0 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -14,12 +14,12 @@ BUILD_DATE="April, 2011"
 #END_VERSION_GENERATION
 
 def soap_login(options):
-	if options.has_key("-z"):
+	if options.has_key("--ssl"):
 		url = "https://";
 	else:
 		url = "http://";
 	
-	url += options["-a"] + ":" + str(options["-u"]) + "/sdk"
+	url += options["--ip"] + ":" + str(options["-u"]) + "/sdk"
 	conn = Client(url + "/vimService.wsdl")
 	conn.set_options(location = url)
 
@@ -30,7 +30,7 @@ def soap_login(options):
 	mo_SessionManager._type = 'SessionManager'
 	
 	try:
-		SessionManager = conn.service.Login(mo_SessionManager, options["-l"], options["-p"])
+		SessionManager = conn.service.Login(mo_SessionManager, options["--username"], options["--password"])
 	except Exception, ex:
 		fail(EC_LOGIN_DENIED)	
 
@@ -104,22 +104,22 @@ def get_power_status(conn, options):
 		uuid.update(more_uuid)
 		mappingToUUID.update(more_mappingToUUID)
 		# Do not run unnecessary SOAP requests
-		if options.has_key("-U") and options["-U"] in uuid:
+		if options.has_key("--uuid") and options["--uuid"] in uuid:
 			break
 
-	if ["list", "monitor"].count(options["-o"]) == 1:
+	if ["list", "monitor"].count(options["--action"]) == 1:
 		return machines
 	else:
-		if options.has_key("-U") == False:
-			if options["-n"].startswith('/'):
+		if options.has_key("--uuid") == False:
+			if options["--plug"].startswith('/'):
 				## Transform InventoryPath to UUID
 				mo_SearchIndex = Property(options["ServiceContent"].searchIndex.value)
 				mo_SearchIndex._type = "SearchIndex"
 			
-				vm = conn.service.FindByInventoryPath(mo_SearchIndex, options["-n"])
+				vm = conn.service.FindByInventoryPath(mo_SearchIndex, options["--plug"])
 			
 				try:
-					options["-U"] = mappingToUUID[vm.value]
+					options["--uuid"] = mappingToUUID[vm.value]
 				except KeyError, ex:
 					fail(EC_STATUS)
 				except AttributeError, ex:
@@ -128,14 +128,14 @@ def get_power_status(conn, options):
 				## Name of virtual machine instead of path
 				## warning: if you have same names of machines this won't work correctly
 				try:
-					(options["-U"], _) = machines[options["-n"]]
+					(options["--uuid"], _) = machines[options["--plug"]]
 				except KeyError, ex:
 					fail(EC_STATUS)
 				except AttributeError, ex:
 					fail(EC_STATUS)
 
 		try:
-			if uuid[options["-U"]] == "poweredOn":
+			if uuid[options["--uuid"]] == "poweredOn":
 				return "on"
 			else:
 				return "off"
@@ -145,12 +145,12 @@ def get_power_status(conn, options):
 def set_power_status(conn, options):
 	mo_SearchIndex = Property(options["ServiceContent"].searchIndex.value)
 	mo_SearchIndex._type = "SearchIndex"
-	vm = conn.service.FindByUuid(mo_SearchIndex, vmSearch = 1, uuid = options["-U"])
+	vm = conn.service.FindByUuid(mo_SearchIndex, vmSearch = 1, uuid = options["--uuid"])
 
 	mo_machine = Property(vm.value)
 	mo_machine._type = "VirtualMachine"
 	
-	if options["-o"] == "on":
+	if options["--action"] == "on":
 		conn.service.PowerOnVM_Task(mo_machine)
 	else:
 		conn.service.PowerOffVM_Task(mo_machine)	
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 2337e10..80b5e96 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -26,18 +26,18 @@ def get_power_status(conn, options):
 
 	conn.send("/S"+"\r\n")
 
-	if isinstance(options["-c"], list):
-		re_all = list(options["-c"])
+	if isinstance(options["--command-prompt"], list):
+		re_all = list(options["--command-prompt"])
 	else:
-		re_all = [options["-c"]]
+		re_all = [options["--command-prompt"]]
 	re_next = re.compile("Enter: ", re.IGNORECASE)
 	re_all.append(re_next)
 
-	result = conn.log_expect(options, re_all, int(options["-Y"]))
+	result = conn.log_expect(options, re_all, int(options["--shell-timeout"]))
 	listing = conn.before
 	if result == (len(re_all) - 1):
 		conn.send("\r\n")
-		conn.log_expect(options, options["-c"], int(options["-Y"]))
+		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 		listing += conn.before
 	
 	plug_section = 0
@@ -52,7 +52,7 @@ def get_power_status(conn, options):
 			plug_line = [x.strip().lower() for x in line.split("|")]
 			if len(plug_line) < len(plug_header):
 				plug_section = -1
-			if ["list", "monitor"].count(options["-o"]) == 0 and options["-n"].lower() == plug_line[plug_index]:
+			if ["list", "monitor"].count(options["--action"]) == 0 and options["--plug"].lower() == plug_line[plug_index]:
 				return plug_line[status_index]
 			else:
 				## We already believe that first column contains plug number
@@ -67,7 +67,7 @@ def get_power_status(conn, options):
 			name_index = plug_header.index("name")
 			status_index = plug_header.index("status")
 
-	if ["list", "monitor"].count(options["-o"]) == 1:
+	if ["list", "monitor"].count(options["--action"]) == 1:
 		return outlets
 	else:
 		return "PROBLEM"
@@ -76,10 +76,10 @@ def set_power_status(conn, options):
 	action = {
 		'on' : "/on",
 		'off': "/off"
-	}[options["-o"]]
+	}[options["--action"]]
 
-	conn.send(action + " " + options["-n"] + ",y\r\n")
-	conn.log_expect(options, options["-c"], int(options["-g"]))
+	conn.send(action + " " + options["--plug"] + ",y\r\n")
+	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 def main():
 	device_opt = [  "ipaddr", "login", "passwd", "passwd_script",
@@ -107,12 +107,12 @@ is running because the connection will block any necessary fencing actions."
 	##
 	## @note: if it possible that this device does not need either login, password or both of them
 	#####	
-	if 0 == options.has_key("-x"):
+	if 0 == options.has_key("--ssh"):
 		try:
 			try:
 				conn = fspawn(options, TELNET_PATH)
 				conn.send("set binary\n")
-				conn.send("open %s -%s\n"%(options["-a"], options["-u"]))
+				conn.send("open %s -%s\n"%(options["--ip"], options["-u"]))
 			except pexpect.ExceptionPexpect, ex:
 				sys.stderr.write(str(ex) + "\n")
 				sys.stderr.write("Due to limitations, binary dependencies on fence agents "
@@ -120,20 +120,20 @@ is running because the connection will block any necessary fencing actions."
 				sys.exit(EC_GENERIC_ERROR)
 			
 			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)
+			re_prompt = re.compile("|".join(map (lambda x: "(" + x + ")", options["--command-prompt"])), re.IGNORECASE)
 
-			result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], int(options["-Y"]))
+			result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], int(options["--shell-timeout"]))
 			if result == 0:
-				if options.has_key("-l"):
-					conn.send(options["-l"]+"\r\n")
-					result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], int(options["-Y"]))
+				if options.has_key("--username"):
+					conn.send(options["--username"]+"\r\n")
+					result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], int(options["--shell-timeout"]))
 				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"], int(options["-Y"]))	
+				if options.has_key("--password"):
+					conn.send(options["--password"]+"\r\n")
+					conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))	
 				else:
 					fail_usage("Failed: You have to enter password or password script")
 		except pexpect.EOF:
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]