From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek 'marx' Grac Date: Mon, 28 Nov 2011 12:07:14 +0100 Subject: [Cluster-devel] [PATCH] fence_rackswitch: Add metadata output for fence_rackswitch agent Message-ID: <1322478434-22302-1-git-send-email-mgrac@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Adding this feature allow us to generate manual pages directly from XML, so both GUI tools and manual pages can see same feature. Resolves: rhbz#714841 (partial) --- fence/agents/rackswitch/Makefile.am | 8 +++ fence/agents/rackswitch/do_rack.c | 46 ++++++++++++++++++- fence/agents/rackswitch/fence_rackswitch.8 | 70 ---------------------------- 3 files changed, 53 insertions(+), 71 deletions(-) delete mode 100644 fence/agents/rackswitch/fence_rackswitch.8 diff --git a/fence/agents/rackswitch/Makefile.am b/fence/agents/rackswitch/Makefile.am index 29cbef8..b6369e4 100644 --- a/fence/agents/rackswitch/Makefile.am +++ b/fence/agents/rackswitch/Makefile.am @@ -9,3 +9,11 @@ noinst_HEADERS = do_rack.h fence_rackswitch_SOURCES = do_rack.c dist_man_MANS = $(TARGET).8 + +fence_rackswitch.8: fence_rackswitch $(top_srcdir)/fence/agents/lib/fence2man.xsl + set -e && \ + ./$^ -o metadata > .$@.tmp && \ + xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@ + +clean-local: + rm -f *.8 .*.8.tmp \ No newline at end of file diff --git a/fence/agents/rackswitch/do_rack.c b/fence/agents/rackswitch/do_rack.c index 854b475..67d24a2 100644 --- a/fence/agents/rackswitch/do_rack.c +++ b/fence/agents/rackswitch/do_rack.c @@ -158,6 +158,40 @@ static void print_usage(void) +static void print_metadata(void) +{ + printf("\n" + "\n" + "fence_rackswitch is an I/O Fencing agent which can be used with the RackSaver RackSwitch. It logs into the RackSwitch and boots a specified plug. Using the http interface to the RackSwitch should be avoided while a GFS cluster is running because the connection may interfere with the operation of this agent.\n" + "http://www.bladenetwork.net\n" + "\n" + "\n" + "\t\n" + "\t\n" + "\tIP Address or Hostname\n" + "\n" + "\n" + "\t\n" + "\t\n" + "\tLogin Name\n" + "\n" + "\n" + "\t\n" + "\t\n" + "\tLogin password or passphrase\n" + "\n" + "\n" + "\t\n" + "\t\n" + "\tScript to retrieve password\n" + "\n" + "\n" + "\n" + "\t\n" + "\n" + "\n"); +} + static void get_options(int argc, char **argv) { int c; @@ -167,7 +201,7 @@ static void get_options(int argc, char **argv) /* * Command line input */ - while ((c = getopt(argc, argv, "ha:n:l:p:S:vqVd")) != -1) + while ((c = getopt(argc, argv, "ha:n:l:p:S:vqVdo:")) != -1) { switch(c) { @@ -220,6 +254,16 @@ static void get_options(int argc, char **argv) fprintf(stderr, "Please use '-h' for usage.\n"); exit(DID_FAILURE); break; + + case 'o': + if (strncasecmp(optarg, "metadata", 254) == 0) { + print_metadata(); + exit(DID_SUCCESS); + } else { + fprintf(stderr, "Only 'metadata' option is aviable for this fence agent\n"); + exit(DID_FAILURE); + } + break; default: fprintf(stderr, "Bad programmer! You forgot to catch the %c flag\n", c); diff --git a/fence/agents/rackswitch/fence_rackswitch.8 b/fence/agents/rackswitch/fence_rackswitch.8 deleted file mode 100644 index fc64a79..0000000 --- a/fence/agents/rackswitch/fence_rackswitch.8 +++ /dev/null @@ -1,70 +0,0 @@ -.TH fence_rackswitch 8 - -.SH NAME -fence_rackswitch - I/O Fencing agent for RackSaver RackSwitch - -.SH SYNOPSIS -.B -fence_rackswitch -[\fIOPTION\fR]... - -.SH DESCRIPTION -fence_rackswitch is an I/O Fencing agent which can be used with the RackSaver -RackSwitch. It logs into the RackSwitch and boots a specified plug. -Using the http interface to the RackSwitch should be avoided while a GFS cluster is -running because the connection may interfere with the operation of this agent. - -fence_rackswitch accepts options on the command line as well as from stdin. -fenced sends the options through stdin when it execs the agent. fence_rackswitch -can be run by itself with command line options which is useful for testing. - -Vendor URL: http://www.bladenetwork.net - -.SH OPTIONS -.TP -\fB-a\fP \fIIPaddress\fP -IP address of the switch. -.TP -\fB-h\fP -Print out a help message describing available options, then exit. -.TP -\fB-n\fP \fIplug\fP -The plug number to power cycle. -.TP -\fB-p\fP \fIpassword\fP -Password for login. -.TP -\fB-S\fP \fIpath\fR -Full path to an executable to generate the password for login. -.TP -\fB-l\fP \fIusername\fP -Username for login. -.TP -\fB-q\fP -Quiet operation. Only print out error messages. -.TP -\fB-V\fP -Print out a version message, then exit. - -.SH STDIN PARAMETERS -.TP -\fIagent = < param >\fR -This option is used by fence_node(8) and is ignored by fence_rackswitch. -.TP -\fIipaddr = < ip >\fR -IP address of the switch. -.TP -\fIusername = < param >\fR -Username for login. -.TP -\fIpassword = < param >\fR -Password for login. -.TP -\fIpasswd_script = < param >\fR -Full path to an executable to generate the password for login. -.TP -\fIport = < param >\fR -The port (outlet) number to act upon. - -.SH SEE ALSO -fence(8), fence_node(8) -- 1.7.4.4