[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] Enable fence_xvm -o metadata



Hi Marek,

Does this look right to you?

-- Lon
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

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]