This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fence-agents: master - fence: Make fence_xvm -o metadata work


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=afde9a77de3eff501d5e1673e73efd91bbf24c28
Commit:        afde9a77de3eff501d5e1673e73efd91bbf24c28
Parent:        d9d3b38ac826821f86c5696c4f93ee409f12234e
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Wed Feb 18 13:28:28 2009 -0500
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Fri Feb 20 10:35:42 2009 -0500

fence: Make fence_xvm -o metadata work

---
 fence/agents/xvm/fence_xvm.c |    5 +++++
 fence/agents/xvm/options.c   |   27 +++++++++++++++++++++++++++
 fence/agents/xvm/options.h   |    4 +++-
 3 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/fence/agents/xvm/fence_xvm.c b/fence/agents/xvm/fence_xvm.c
index c072cf6..ff80361 100644
--- a/fence/agents/xvm/fence_xvm.c
+++ b/fence/agents/xvm/fence_xvm.c
@@ -338,6 +338,11 @@ main(int argc, char **argv)
 		exit(0);
 	}
 
+	if (args.flags & F_METADATA) {
+		args_metadata(argv[0], my_options);
+		exit(0);
+	}
+
 	if (args.flags & F_VERSION) {
 		printf("%s %s\n", basename(argv[0]), XVM_VERSION);
 		printf("fence release %s\n", RELEASE_VERSION);
diff --git a/fence/agents/xvm/options.c b/fence/agents/xvm/options.c
index 49e6578..00a2f75 100644
--- a/fence/agents/xvm/options.c
+++ b/fence/agents/xvm/options.c
@@ -181,6 +181,8 @@ assign_op(fence_xvm_args_t *args, struct arg_info *arg, char *value)
 		args->op = FENCE_OFF;
 	} else if (!strcasecmp(value, "reboot")) {
 		args->op = FENCE_REBOOT;
+	} else if (!strcasecmp(value, "metadata")) {
+		args->flags |= F_METADATA;
 	} else {
 		logt_print(LOG_ERR, "Unsupported operation: %s\n", value);
 		args->flags |= F_ERR;
@@ -509,6 +511,31 @@ args_usage(char *progname, char *optstr, int print_stdin)
 }
 
 
+void
+args_metadata(char *progname, char *optstr)
+{
+	int x;
+	struct arg_info *arg;
+
+	printf("<parameters>\n");
+
+	for (x = 0; x < strlen(optstr); x++) {
+		arg = find_arg_by_char(optstr[x]);
+		if (!arg)
+			continue;
+		if (!arg->stdin_opt)
+			continue;
+
+		printf("\t<parameter name=\"%s\">\n",arg->stdin_opt);
+		printf("\t\t<shortdesc lang=\"C\">%s</shortdesc>\n",
+		       arg->desc);
+		printf("\t</parameter>\n");
+	}
+
+	printf("</parameters>\n");
+}
+
+
 /**
   Remove leading and trailing whitespace from a line of text.
 
diff --git a/fence/agents/xvm/options.h b/fence/agents/xvm/options.h
index ecf5439..b13cf9b 100644
--- a/fence/agents/xvm/options.h
+++ b/fence/agents/xvm/options.h
@@ -11,7 +11,8 @@ typedef enum {
 	F_CCSERR	= 0x40,
 	F_CCSFAIL	= 0x80,
 	F_NOCLUSTER	= 0x100,
-	F_DEBUG		= 0x200
+	F_DEBUG		= 0x200,
+	F_METADATA	= 0x400
 } arg_flags_t;
 
 
@@ -52,6 +53,7 @@ void args_get_getopt(int argc, char **argv, char *optstr,
 void args_get_stdin(char *optstr, fence_xvm_args_t *args);
 void args_get_ccs(char *optstr, fence_xvm_args_t *args);
 void args_usage(char *progname, char *optstr, int print_stdin);
+void args_metadata(char *progname, char *optstr);
 void args_print(fence_xvm_args_t *args);
 
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]