From e70c7da2565b692bd382df0ba0f44834c134ecd2 Mon Sep 17 00:00:00 2001 From: Marek 'marx' Grac <mgrac@redhat.com> Date: Tue, 20 Apr 2010 19:46:58 +0200 Subject: [PATCH] fencing: add information needed for automatic man page generation Resolves: rhbz#488959 (partially) --- fence/agents/apc/fence_apc.py | 10 ++++++++- fence/agents/apc_snmp/fence_apc_snmp.py | 11 ++++++++- fence/agents/bladecenter/fence_bladecenter.py | 11 ++++++++- fence/agents/cisco_mds/fence_cisco_mds.py | 7 +++++- fence/agents/drac/fence_drac5.py | 10 ++++++++- fence/agents/egenera/fence_egenera.pl | 6 ++-- fence/agents/eps/fence_eps.py | 13 +++++++++++- fence/agents/ibmblade/fence_ibmblade.py | 10 ++++++++- fence/agents/ilo/fence_ilo.py | 10 ++++++++- fence/agents/ilo_mp/fence_ilo_mp.py | 6 ++++- fence/agents/lib/fencing.py.py | 8 ++++-- fence/agents/lpar/fence_lpar.py | 14 ++++++------ fence/agents/rsa/fence_rsa.py | 11 +++++++++- fence/agents/rsb/fence_rsb.py | 2 +- fence/agents/sanbox2/fence_sanbox2.py | 10 ++++++++- fence/agents/virsh/fence_virsh.py | 11 +++++++++- fence/agents/vmware/fence_vmware.py | 26 ++++++++++++++++++++++++- fence/agents/wti/fence_wti.py | 10 ++++++++- fence/agents/xcat/fence_xcat.pl | 4 +- 19 files changed, 158 insertions(+), 32 deletions(-) diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py index 2985072..b9e253e 100755 --- a/fence/agents/apc/fence_apc.py +++ b/fence/agents/apc/fence_apc.py @@ -201,7 +201,15 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = "\n>" - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for APC over telnet/ssh" + docs["longdesc"] = "fence_apc is an I/O Fencing agent \ +which can be used with the APC network power switch. It logs into device \ +via telnet/ssh and reboots a specified outlet. Lengthy telnet/ssh connections \ +should be avoided while a GFS cluster is running because the connection \ +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(":")): diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py index d2d67b2..6251073 100755 --- a/fence/agents/apc_snmp/fence_apc_snmp.py +++ b/fence/agents/apc_snmp/fence_apc_snmp.py @@ -174,7 +174,7 @@ def main(): atexit.register(atexit_handler) - snmp_define_defaults() + snmp_define_defaults () apc_snmp_define_defaults() options=check_input(device_opt,process_input(device_opt)) @@ -189,7 +189,14 @@ def main(): if (not (options.has_key("-s"))): options["-s"]="1" - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for APC over SNMP" + docs["longdesc"] = "fence_apc_snmp is an I/O Fencing agent \ +which can be used with the APC network power switch. It logs \ +into a device via SNMP and reboots a specified outlet. It supports \ +SNMP v1 and v3 with all combinations of authenticity/privacy settings." + docs["vendorurl"] = "http://www.apc.com" + show_docs(options, docs) # Operate the fencing device result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status) diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py index 0cc189c..b4f7eb9 100755 --- a/fence/agents/bladecenter/fence_bladecenter.py +++ b/fence/agents/bladecenter/fence_bladecenter.py @@ -105,8 +105,15 @@ def main(): options = check_input(device_opt, process_input(device_opt)) - show_docs(options) - + docs = { } + docs["shortdesc"] = "Fence agent for IBM BladeCenter" + docs["longdesc"] = "fence_bladecenter is an I/O Fencing agent \ +which can be used with IBM Bladecenters with recent enough firmware that \ +includes telnet support. It logs into a Brocade chasis via telnet or ssh \ +and uses the command line interface to power on and off blades." + docs["vendorurl"] = "http://www.ibm.com" + show_docs(options, docs) + ## ## 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 032983d..2371f4a 100644 --- a/fence/agents/cisco_mds/fence_cisco_mds.py +++ b/fence/agents/cisco_mds/fence_cisco_mds.py @@ -107,7 +107,12 @@ def main(): options = check_input(device_opt, options) - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for Cisco MDS" + docs["longdesc"] = "fence_cisco_mds is an I/O Fencing agent \ +which can be used with any Cisco MDS 9000 series with SNMP enabled device." + docs["vendorurl"] = "http://www.cisco.com" + show_docs(options, docs) if (not (options["-o"] in ["list","monitor"])): port_oid=cisco_port2oid(options["-n"]) diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py index 11d8434..46c9fb0 100755 --- a/fence/agents/drac/fence_drac5.py +++ b/fence/agents/drac/fence_drac5.py @@ -97,7 +97,15 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = "\$" - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for Dell DRAC CMC/5" + docs["longdesc"] = "fence_drac5 is an I/O Fencing agent \ +which can be used with the Dell Remote Access Card v5 or CMC (DRAC). \ +This device provides remote access to controlling power to a server. \ +It logs into the DRAC through the telnet/ssh interface of the card. \ +By default, the telnet interface is not enabled." + docs["vendorurl"] = "http://www.dell.com" + show_docs(options, docs) ## ## Operate the fencing device diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl index 8607919..ce191cd 100755 --- a/fence/agents/egenera/fence_egenera.pl +++ b/fence/agents/egenera/fence_egenera.pl @@ -305,9 +305,9 @@ sub pserver_boot sub pserver_shutdown { my $rtrn=1; - local *egen_log; - open(egen_log,">>/@LOGDIR@/eglog"); - print egen_log "Attempting shutdown at ".`date`."\n"; + local *egen_log; + open(egen_log,">>/@LOGDIR@/fence_egenera.log"); + print egen_log "Attempting shutdown at ".`date`."\n"; for (my $trys=0; $trys<20; $trys++) { last if (pserver_status != 0); diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py index daec240..f781106 100644 --- a/fence/agents/eps/fence_eps.py +++ b/fence/agents/eps/fence_eps.py @@ -107,7 +107,18 @@ def main(): if (not options.has_key("-c")): options["-c"]="hidden.htm" - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for ePowerSwitch" + docs["longdesc"] = "fence_eps is an I/O Fencing agent \ +which can be used with the ePowerSwitch 8M+ power switch to fence \ +connected machines. Fence agent works ONLY on 8M+ device, because \ +this is only one, which has support for hidden page feature. \ +\n.TP\n\ +Agent basically works by connecting to hidden page and pass \ +appropriate arguments to GET request. This means, that hidden \ +page feature must be enabled and properly configured." + docs["vendorurl"] = "http://www.epowerswitch.com" + show_docs(options, docs) #Run fence action. Conn is None, beacause we always need open new http connection result = fence_action(None, options, set_power_status, get_power_status,get_power_status) diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py index a0d0884..10b548b 100644 --- a/fence/agents/ibmblade/fence_ibmblade.py +++ b/fence/agents/ibmblade/fence_ibmblade.py @@ -66,11 +66,19 @@ def main(): atexit.register(atexit_handler) + snmp_define_defaults () ibmblade_define_defaults() options=check_input(device_opt,process_input(device_opt)) - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for IBM BladeCenter over SNMP" + docs["longdesc"] = "fence_ibmblade is an I/O Fencing agent \ +which can be used with IBM BladeCenter chassis. It issues SNMP Set \ +request to BladeCenter chassis, rebooting, powering up or down \ +the specified Blade Server." + docs["vendorurl"] = "http://www.ibm.com" + show_docs(options, docs) # Operate the fencing device result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status) diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py index 380a91d..a782250 100755 --- a/fence/agents/ilo/fence_ilo.py +++ b/fence/agents/ilo/fence_ilo.py @@ -70,7 +70,15 @@ def main(): LOGIN_TIMEOUT = 10 - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for HP iLO" + docs["longdesc"] = "fence_ilo is an I/O Fencing agent \ +used for HP servers with the Integrated Light Out (iLO) PCI card.\ +The agent opens an SSL connection to the iLO card. Once the SSL \ +connection is established, the agent is able to communicate with \ +the iLO card through an XML stream." + docs["vendorurl"] = "http://www.hp.com" + show_docs(options, docs) ## ## Login and get version number diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py index c1ef5da..eef4f30 100644 --- a/fence/agents/ilo_mp/fence_ilo_mp.py +++ b/fence/agents/ilo_mp/fence_ilo_mp.py @@ -57,7 +57,11 @@ def main(): options = check_input(device_opt, process_input(device_opt)) - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for HP iLO MP" + docs["longdesc"] = "" + docs["vendorurl"] = "http://www.hp.com" + show_docs(options, docs) conn = fence_login(options) conn.send("SMCLP\r\n") diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index a7647f7..0128a20 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -376,7 +376,7 @@ def atexit_handler(): os.close(1) except IOError: sys.stderr.write("%s failed to close standard output\n"%(sys.argv[0])) - sys.exit(1) + sys.exit(EC_GENERIC_ERROR) def version(command, release, build_date, copyright_notice): print command, " ", release, " ", build_date @@ -423,8 +423,10 @@ def metadata(avail_opt, options, docs): sorted_list.sort(lambda x, y: cmp(x[1]["order"], y[1]["order"])) print "<?xml version=\"1.0\" ?>" - print "<resource-agent name=\"" + os.path.basename(sys.argv[0])[:-3] + "\" shortdesc=\"" + docs["shortdesc"] + "\" >" + print "<resource-agent name=\"" + os.path.basename(sys.argv[0]) + "\" shortdesc=\"" + docs["shortdesc"] + "\" >" print "<longdesc>" + docs["longdesc"] + "</longdesc>" + if docs.has_key("vendorurl"): + print "<vendor-url>" + docs["vendorurl"] + "</vendor-url>" print "<parameters>" for option, value in sorted_list: if all_opt[option].has_key("shortdesc"): @@ -467,7 +469,7 @@ def metadata(avail_opt, options, docs): print "\t<action name=\"status\" />" print "\t<action name=\"list\" />" print "\t<action name=\"monitor\" />" - print "\t<action name=\"meta-data\" />" + print "\t<action name=\"metadata\" />" print "</actions>" print "</resource-agent>" @@ -825,7 +825,6 @@ 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"] - try: conn = fspawn(command) except pexpect.ExceptionPexpect, ex: diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py index a2b672c..5b12716 100755 --- a/fence/agents/lpar/fence_lpar.py +++ b/fence/agents/lpar/fence_lpar.py @@ -139,21 +139,21 @@ def main(): atexit.register(atexit_handler) - all_opt["login_timeout"]["default"] = 15 - all_opt["secure"]["default"] = 1 + all_opt["login_timeout"]["default"] = "15" + all_opt["secure"]["default"] = "1" options = check_input(device_opt, process_input(device_opt)) ## - ## Fence agent specific defaults + ## Fence agent specific settings and default values ##### if 0 == options.has_key("-c"): options["-c"] = [ ":~>", "]\$", "\$ " ] - if 0 == options.has_key("-H"): - options["-H"] = "4" - - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for IBM LPAR" + docs["longdesc"] = "" + show_docs(options, docs) if 0 == options.has_key("-s"): fail_usage("Failed: You have to enter name of managed system") diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py index e9eac5f..d836711 100755 --- a/fence/agents/rsa/fence_rsa.py +++ b/fence/agents/rsa/fence_rsa.py @@ -58,7 +58,16 @@ def main(): # This device will not allow us to login even with LANG=C options["ssh_options"] = "-F /dev/null" - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for IBM RSA" + docs["longdesc"] = "fence_rsa is an I/O Fencing agent \ +which can be used with the IBM RSA II management interface. It \ +logs into an RSA II device via telnet and reboots the associated \ +machine. Lengthy telnet connections to the RSA II device should \ +be avoided while a GFS cluster is running because the connection \ +will block any necessary fencing actions." + docs["vendorurl"] = "http://www.ibm.com" + show_docs(options, docs) ## ## Operate the fencing device diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py index a98c0f5..cb4f436 100755 --- a/fence/agents/rsb/fence_rsb.py +++ b/fence/agents/rsb/fence_rsb.py @@ -181,7 +181,7 @@ def main(): try: a = params["option"] - a_lower = a.lower() + a_lower=a.lower() if a_lower == "off": action = POWER_OFF elif a_lower == "on": diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py index 12c0e2e..c95e602 100644 --- a/fence/agents/sanbox2/fence_sanbox2.py +++ b/fence/agents/sanbox2/fence_sanbox2.py @@ -123,7 +123,15 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = [ " #> " ] - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for QLogic SANBox2 FC switches" + docs["longdesc"] = "fence_sanbox2 is an I/O Fencing agent which can be used with \ +QLogic SANBox2 FC switches. It logs into a SANBox2 switch via telnet and disables a specified \ +port. Disabling the port which a machine is connected to effectively fences that machine. \ +Lengthy telnet connections to the switch should be avoided while a GFS cluster is running \ +because the connection will block any necessary fencing actions." + docs["vendorurl"] = "http://www.qlogic.com" + show_docs(options, docs) ## ## Operate the fencing device diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py index 9cb5a12..a266150 100644 --- a/fence/agents/virsh/fence_virsh.py +++ b/fence/agents/virsh/fence_virsh.py @@ -79,7 +79,16 @@ def main(): options["ssh_options"]="-t '/bin/bash -c \"PS1=\[EXPECT\]#\ /bin/bash --noprofile --norc\"'" - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for virsh" + docs["longdesc"] = "fence_virsh is an I/O Fencing agent \ +which can be used with the virtual machines managed by libvirt. \ +It logs via ssh to a dom0 and there run virsh command, which does \ +all work. \ +\n.P\n\ +By default, virsh needs root account to do properly work. So you \ +must allow ssh login in your sshd_config." + show_docs(options, docs) ## Operate the fencing device conn = fence_login(options) diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py index a5e2277..a88ed91 100644 --- a/fence/agents/vmware/fence_vmware.py +++ b/fence/agents/vmware/fence_vmware.py @@ -299,7 +299,31 @@ def main(): # Default is secure connection options["-x"] = 1 - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for VMWare" + docs["longdesc"] = "fence_vmware is an I/O Fencing agent \ +which can be used with the VMware ESX, VMware ESXi or VMware Server \ +to fence virtual machines.\ +\n.P\n\ +Before you can use this agent, it must be installed VI Perl Toolkit or \ +vmrun command on every node you want to make fencing.\ +\n.P\n\ +VI Perl Toolkit is preferred for VMware ESX/ESXi and Virtual Center. Vmrun \ +command is only solution for VMware Server 1/2 (this command will works against \ +ESX/ESXi 3.5 up2 and VC up2 too, but not cluster aware!) and is available as part \ +of VMware VIX API SDK package. VI Perl and VIX API SDK are both available from \ +VMware web pages (not int RHEL repository!). \ +\n.P\n\ +You can specify type of VMware you are connecting to with \\fB-d\\fP switch \ +(or \\fIvmware_type\\fR for stdin). Possible values are esx, server2 and server1.\ +Default value is esx, which will use VI Perl. With server1 and server2, vmrun \ +command is used.\ +\n.P\n\ +After you have successfully installed VI Perl Toolkit or VIX API, you should \ +be able to run fence_vmware_helper (part of this agent) or vmrun command. \ +This agent supports only vmrun from version 2.0.0 (VIX API 1.6.0)." + docs["vendorurl"] = "http://www.vmware.com" + show_docs(options, docs) # Check vmware type and set path vmware_check_vmware_type(options) diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py index 3198aeb..292dcaa 100755 --- a/fence/agents/wti/fence_wti.py +++ b/fence/agents/wti/fence_wti.py @@ -90,7 +90,15 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = [ "RSM>", "MPC>", "IPS>", "TPS>", "NBB>", "NPS>" ] - show_docs(options) + docs = { } + docs["shortdesc"] = "Fence agent for WTI" + docs["longdesc"] = "fence_wti is an I/O Fencing agent \ +which can be used with the WTI Network Power Switch (NPS). It logs \ +into an NPS via telnet or ssh and boots a specified plug. \ +Lengthy telnet connections to the NPS should be avoided while a GFS cluster \ +is running because the connection will block any necessary fencing actions." + docs["vendorurl"] = "http://www.wti.com" + show_docs(options, docs) ## ## Operate the fencing device diff --git a/fence/agents/xcat/fence_xcat.pl b/fence/agents/xcat/fence_xcat.pl index 209c680..1b5b2c2 100755 --- a/fence/agents/xcat/fence_xcat.pl +++ b/fence/agents/xcat/fence_xcat.pl @@ -138,7 +138,7 @@ if (@ARGV > 0) { fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-n' flag specified." unless defined $opt_n; - $opt_o=lc($opt_o) + $opt_o=lc($opt_o); fail_usage "Unrecognised action '$opt_o' for '-o' flag" unless $opt_o =~ /^(on|off|reset|stat)$/; @@ -146,7 +146,7 @@ if (@ARGV > 0) { get_options_stdin(); fail "failed: no plug number" unless defined $opt_n; - $opt_o=lc($opt_o) + $opt_o=lc($opt_o); fail "failed: unrecognised action: $opt_o" unless $opt_o =~ /^(on|off|reset|stat)$/; } -- 1.6.0.6