FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 11-28-2011, 10:07 AM
"Marek 'marx' Grac"
 
Default fence_rackswitch: Add metadata output for fence_rackswitch agent

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("<?xml version="1.0" ?>
"
+ "<resource-agent name="fence_rackswitch" shortdesc="fence_rackswitch - I/O Fencing agent for RackSaver RackSwitch" >
"
+ "<longdesc>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.</longdesc>
"
+ "<vendor-url>http://www.bladenetwork.net</vendor-url>
"
+ "<parameters>
"
+ "<parameter name="ipaddr" unique="1" required="1">
"
+ " <getopt mixed="-a &lt;ip&gt;" />
"
+ " <content type="string" />
"
+ " <shortdesc lang="en">IP Address or Hostname</shortdesc>
"
+ "</parameter>
"
+ "<parameter name="login" unique="1" required="1">
"
+ " <getopt mixed="-l &lt;name&gt;" />
"
+ " <content type="string" />
"
+ " <shortdesc lang="en">Login Name</shortdesc>
"
+ "</parameter>
"
+ "<parameter name="passwd" unique="1" required="0">
"
+ " <getopt mixed="-p &lt;password&gt;" />
"
+ " <content type="string" />
"
+ " <shortdesc lang="en">Login password or passphrase</shortdesc>
"
+ "</parameter>
"
+ "<parameter name="passwd_script" unique="1" required="0">
"
+ " <getopt mixed="-S &lt;script&gt;" />
"
+ " <content type="string" />
"
+ " <shortdesc lang="en">Script to retrieve password</shortdesc>
"
+ "</parameter>
"
+ "</parameters>
"
+ "<actions>
"
+ " <action name="metadata" />
"
+ "</actions>
"
+ "</resource-agent>
");
+}
+
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:S:vqVd")) != -1)
+ while ((c = getopt(argc, argv, "ha:n:l:S:vqVdo:")) != -1)
{
switch(c)
{
@@ -220,6 +254,16 @@ static void get_options(int argc, char **argv)
fprintf(stderr, "Please use '-h' for usage.
");
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
");
+ exit(DID_FAILURE);
+ }
+ break;

default:
fprintf(stderr, "Bad programmer! You forgot to catch the %c flag
", 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
-[fIOPTIONfR]...
-
-.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-afP fIIPaddressfP
-IP address of the switch.
-.TP
-fB-hfP
-Print out a help message describing available options, then exit.
-.TP
-fB-nfP fIplugfP
-The plug number to power cycle.
-.TP
-fB-pfP fIpasswordfP
-Password for login.
-.TP
-fB-SfP fIpathfR
-Full path to an executable to generate the password for login.
-.TP
-fB-lfP fIusernamefP
-Username for login.
-.TP
-fB-qfP
-Quiet operation. Only print out error messages.
-.TP
-fB-VfP
-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
 

Thread Tools




All times are GMT. The time now is 04:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org