From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25957 invoked by alias); 19 Jun 2009 11:02:30 -0000 Received: (qmail 25743 invoked by alias); 19 Jun 2009 11:02:30 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE3 - fence agents: Option for setting port for telnet/ssh/ssl used by fence agent To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: 992908c4470e8fd57b1dc031bee98e29b05c2049 X-Git-Newrev: 62b36a1b9cc01f1f1b9b35c022282257da469295 From: =?utf-8?q?Marek_Gr=C3=A1c?= Message-Id: <20090619110203.F0F05120343@lists.fedorahosted.org> Date: Fri, 19 Jun 2009 11:02:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00563.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=62b36a1b9cc01f1f1b9b35c022282257da469295 Commit: 62b36a1b9cc01f1f1b9b35c022282257da469295 Parent: 992908c4470e8fd57b1dc031bee98e29b05c2049 Author: Marek 'marx' Grac AuthorDate: Fri Jun 19 12:57:52 2009 +0200 Committer: Marek 'marx' Grac CommitterDate: Fri Jun 19 12:57:52 2009 +0200 fence agents: Option for setting port for telnet/ssh/ssl used by fence agent On some fencing devices there is possibility to change default port where ssh/ssl/telnet/... is listening. There is new option 'ipport' (getopt: -u) which can be used for this purpose. It is probable that it will make option 'udpport' (also -u; currently used in SNMP based agents) obsoleted in one of the next versions. Resolves Red Hat Bugzilla #496446 --- fence/agents/alom/fence_alom.py | 2 +- fence/agents/apc/fence_apc.py | 2 +- fence/agents/bladecenter/fence_bladecenter.py | 2 +- fence/agents/drac/fence_drac5.py | 2 +- fence/agents/ilo/fence_ilo.py | 2 +- fence/agents/ldom/fence_ldom.py | 2 +- fence/agents/lib/fencing.py.py | 23 +++++++++++++++++++---- fence/agents/lpar/fence_lpar.py | 2 +- fence/agents/rsa/fence_rsa.py | 2 +- fence/agents/virsh/fence_virsh.py | 2 +- fence/agents/wti/fence_wti.py | 2 +- 11 files changed, 29 insertions(+), 14 deletions(-) diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py index 0ad5082..610ec2b 100644 --- a/fence/agents/alom/fence_alom.py +++ b/fence/agents/alom/fence_alom.py @@ -45,7 +45,7 @@ def set_power_status(conn, options): def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "secure", "test", "inet4_only", "inet6_only" ] + "secure", "test", "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py index 00c1013..13bad67 100755 --- a/fence/agents/apc/fence_apc.py +++ b/fence/agents/apc/fence_apc.py @@ -185,7 +185,7 @@ 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" ] + "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py index ae0f37a..d694966 100644 --- a/fence/agents/bladecenter/fence_bladecenter.py +++ b/fence/agents/bladecenter/fence_bladecenter.py @@ -91,7 +91,7 @@ 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" ] + "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py index ef105d5..af4a1ed 100755 --- a/fence/agents/drac/fence_drac5.py +++ b/fence/agents/drac/fence_drac5.py @@ -84,7 +84,7 @@ 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" ] + "separator", "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py index 2b7cb85..c2fd70b 100755 --- a/fence/agents/ilo/fence_ilo.py +++ b/fence/agents/ilo/fence_ilo.py @@ -56,7 +56,7 @@ 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" ] + "ssl", "ribcl", "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py index 4839faa..021f036 100644 --- a/fence/agents/ldom/fence_ldom.py +++ b/fence/agents/ldom/fence_ldom.py @@ -84,7 +84,7 @@ def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", "secure", "identity_file", "test" , "port", "cmd_prompt", - "separator", "inet4_only", "inet6_only" ] + "separator", "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index 5b2f8ed..feb01f8 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -78,6 +78,13 @@ all_opt = { "required" : "1", "shortdesc" : "IP Address or Hostname", "order" : 1 }, + "ipport" : { + "getopt" : "u:", + "longopt" : "ipport", + "help" : "-u, --ipport= TCP port to use", + "required" : "0", + "shortdesc" : "TCP port to use for connection with device", + "order" : 1 }, "login" : { "getopt" : "l:", "longopt" : "username", @@ -546,6 +553,14 @@ def check_input(device_opt, opt): if options.has_key("-R"): options["-P"] = os.popen(options["-R"]).read().rstrip() + if options.has_key("-u") == False: + if options.has_key("-x"): + options["-u"] = 22 + elif options.has_key("-z"): + options["-u"] = 443 + else: + options["-u"] = 23 + return options def wait_power_status(tn, options, get_power_fn): @@ -628,10 +643,10 @@ def fence_login(options): re_pass = re.compile("password", re.IGNORECASE) if options.has_key("-z"): - command = '%s %s %s %s' % (SSL_PATH, force_ipvx, options["-a"], "443") + command = '%s %s %s %s' % (SSL_PATH, force_ipvx, options["-a"], options["-u"]) conn = fspawn(command) elif options.has_key("-x") and 0 == options.has_key("-k"): - command = '%s %s %s@%s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"]) + 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) @@ -654,7 +669,7 @@ def fence_login(options): conn.sendline(options["-p"]) conn.log_expect(options, options["-c"], LOGIN_TIMEOUT) elif options.has_key("-x") and 1 == options.has_key("-k"): - command = '%s %s %s@%s -i %s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"], options["-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) @@ -672,7 +687,7 @@ def fence_login(options): else: conn = fspawn(TELNET_PATH) conn.send("set binary\n") - conn.send("open %s\n"%(options["-a"])) + conn.send("open %s -%s\n"%(options["-a"], options["-u"])) conn.log_expect(options, re_login, LOGIN_TIMEOUT) conn.send(options["-l"]+"\r\n") conn.log_expect(options, re_pass, SHELL_TIMEOUT) diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py index b0086d8..cb74f1d 100644 --- a/fence/agents/lpar/fence_lpar.py +++ b/fence/agents/lpar/fence_lpar.py @@ -133,7 +133,7 @@ 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" ] + "separator", "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py index e7f131c..dd2f579 100644 --- a/fence/agents/rsa/fence_rsa.py +++ b/fence/agents/rsa/fence_rsa.py @@ -41,7 +41,7 @@ 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" ] + "cmd_prompt", "secure", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py index bbb88ec..6866fb0 100644 --- a/fence/agents/virsh/fence_virsh.py +++ b/fence/agents/virsh/fence_virsh.py @@ -63,7 +63,7 @@ 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" ] + "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler) diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py index 98b1d49..9f5d59f 100644 --- a/fence/agents/wti/fence_wti.py +++ b/fence/agents/wti/fence_wti.py @@ -76,7 +76,7 @@ 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" ] + "test", "separator", "inet4_only", "inet6_only", "ipport" ] atexit.register(atexit_handler)