public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: "Marek Grác" <marx@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: RHEL55 - fence: Add support for IPv4/IPv6 forcing Date: Mon, 31 Aug 2009 16:02:00 -0000 [thread overview] Message-ID: <20090831160153.52C5B1201FC@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=48dea103eae0f4e963d295e21c242cb104d35d65 Commit: 48dea103eae0f4e963d295e21c242cb104d35d65 Parent: a39b80511c6a44a838fb549297f4d696c5e299e2 Author: Marek 'marx' Grac <mgrac@redhat.com> AuthorDate: Mon Aug 31 16:54:56 2009 +0200 Committer: Marek 'marx' Grac <mgrac@redhat.com> CommitterDate: Mon Aug 31 16:54:56 2009 +0200 fence: Add support for IPv4/IPv6 forcing Support is added for agents written in Python, which uses standard fencing library and connecting by SNMP/nss_wrapper or SSH. Sadly telnet distributed with Fedora/RHEL doesn't has support for forcing IPv4/IPv6 connection, so it's impossible to implement this feature for agents using it. --- fence/agents/apc/fence_apc.py | 3 +- fence/agents/bladecenter/fence_bladecenter.py | 3 +- fence/agents/cisco_mds/fence_cisco_mds.py | 2 +- fence/agents/drac/fence_drac5.py | 2 +- fence/agents/ilo/fence_ilo.py | 2 +- fence/agents/lib/fencing.py.py | 32 ++++++++++++++++++++++-- fence/agents/lpar/fence_lpar.py | 2 +- fence/agents/virsh/fence_virsh.py | 3 +- fence/agents/wti/fence_wti.py | 2 +- 9 files changed, 40 insertions(+), 11 deletions(-) diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py index b178a50..447d589 100755 --- a/fence/agents/apc/fence_apc.py +++ b/fence/agents/apc/fence_apc.py @@ -185,7 +185,8 @@ def set_power_status(conn, options): def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "secure", "port", "switch", "test", "separator" ] + "secure", "port", "switch", "test", "separator", + "inet4_only", "inet6_only" ] atexit.register(atexit_handler) diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py index da857ab..7f6acd7 100755 --- a/fence/agents/bladecenter/fence_bladecenter.py +++ b/fence/agents/bladecenter/fence_bladecenter.py @@ -91,7 +91,8 @@ def get_blades_list(conn, options): def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "cmd_prompt", "secure", "port", "identity_file", "separator" ] + "cmd_prompt", "secure", "port", "identity_file", "separator", + "inet4_only", "inet6_only" ] atexit.register(atexit_handler) diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py index 0817785..3ac5295 100644 --- a/fence/agents/cisco_mds/fence_cisco_mds.py +++ b/fence/agents/cisco_mds/fence_cisco_mds.py @@ -86,7 +86,7 @@ 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"] + "udpport","inet4_only","inet6_only"] atexit.register(atexit_handler) diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py index ec210c5..0eece4a 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" ] + "separator", "inet4_only", "inet6_only" ] atexit.register(atexit_handler) diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py index 7105253..4fd8404 100755 --- a/fence/agents/ilo/fence_ilo.py +++ b/fence/agents/ilo/fence_ilo.py @@ -57,7 +57,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" ] + "ssl", "ribcl", "inet4_only", "inet6_only" ] atexit.register(atexit_handler) diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index e875c81..04527d1 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -206,6 +206,20 @@ all_opt = { "getopt" : "R:", "help" : "-R <script> Script to run to retrieve privacy password", "order" : 1}, + "inet4_only" : { + "getopt" : "4", + "longopt" : "inet4-only", + "help" : "-4, --inet4-only Forces agent to use IPv4 addresses only", + "required" : "0", + "shortdesc" : "Forces agent to use IPv4 addresses only", + "order" : 1 }, + "inet6_only" : { + "getopt" : "6", + "longopt" : "inet6-only", + "help" : "-6, --inet6-only Forces agent to use IPv6 addresses only", + "required" : "0", + "shortdesc" : "Forces agent to use IPv6 addresses only", + "order" : 1 }, "udpport" : { "getopt" : "u:", "help" : "-u <port> UDP/TCP port to use", @@ -517,15 +531,23 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None 1 def fence_login(options): + force_ipvx="" + + if (options.has_key("-6")): + force_ipvx="-6 " + + if (options.has_key("-4")): + force_ipvx="-4 " + try: re_login = re.compile("(login: )|(Login Name: )|(username: )|(User Name :)", re.IGNORECASE) re_pass = re.compile("password", re.IGNORECASE) if options.has_key("-z"): - command = '%s %s %s' % (SSL_PATH, options["-a"], "443") + command = '%s %s %s %s' % (SSL_PATH, force_ipvx, options["-a"], "443") conn = fspawn(command) elif options.has_key("-x") and 0 == options.has_key("-k"): - command = '%s %s@%s' % (SSH_PATH, options["-l"], options["-a"]) + command = '%s %s %s@%s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"]) if options.has_key("ssh_options"): command += ' ' + options["ssh_options"] conn = fspawn(command) @@ -536,7 +558,11 @@ 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"): - conn = fspawn('%s %s@%s -i %s' % (SSH_PATH, options["-l"], options["-a"], options["-k"])) + command = '%s %s %s@%s -i %s' % (SSH_PATH, force_ipvx, options["-l"], options["-a"], options["-k"]) + 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) if result == 1: conn.sendline("yes") diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py index 0836a10..9e177fb 100755 --- a/fence/agents/lpar/fence_lpar.py +++ b/fence/agents/lpar/fence_lpar.py @@ -134,7 +134,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" ] + "separator", "inet4_only", "inet6_only" ] atexit.register(atexit_handler) diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py index aadb77b..4097d96 100644 --- a/fence/agents/virsh/fence_virsh.py +++ b/fence/agents/virsh/fence_virsh.py @@ -63,7 +63,8 @@ def set_power_status(conn, options): def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "secure", "identity_file", "test", "port", "separator" ] + "secure", "identity_file", "test", "port", "separator", + "inet4_only", "inet6_only" ] atexit.register(atexit_handler) diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py index e83a783..062e1a5 100755 --- a/fence/agents/wti/fence_wti.py +++ b/fence/agents/wti/fence_wti.py @@ -77,7 +77,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" ] + "test", "separator", "inet4_only", "inet6_only" ] atexit.register(atexit_handler)
reply other threads:[~2009-08-31 16:02 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090831160153.52C5B1201FC@lists.fedorahosted.org \ --to=marx@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).