Blob Blame History Raw
diff -ur a/client/main.c b/client/main.c
--- a/client/main.c	2017-08-09 13:13:20.000846414 -0400
+++ b/client/main.c	2017-08-09 13:09:04.294571613 -0400
@@ -110,13 +110,17 @@
 	}
 
 	if (args.flags & F_ERR) {
-		args_usage(argv[0], my_options, (argc == 1));
+        if (args.op != FENCE_VALIDATEALL)
+			args_usage(argv[0], my_options, (argc == 1));
 		exit(1);
 	}
 
+	if (args.op == FENCE_VALIDATEALL)
+		exit(0);
+
 	if (args.op == FENCE_METADATA) {
 		args_metadata(argv[0], my_options);
-		return 0;
+		exit(0);
 	}
 
 	if (args.delay > 0 &&
diff -ur a/client/options.c b/client/options.c
--- a/client/options.c	2017-08-09 13:13:20.007846312 -0400
+++ b/client/options.c	2017-08-09 13:11:23.464550208 -0400
@@ -255,6 +255,8 @@
 		args->op = FENCE_HOSTLIST;
 	} else if (!strcasecmp(value, "metadata")) {
 		args->op = FENCE_METADATA;
+	} else if (!strcasecmp(value, "validate-all")) {
+		args->op = FENCE_VALIDATEALL;
 	} else {
 		printf("Unsupported operation: %s\n", value);
 		args->flags |= F_ERR;
@@ -490,12 +492,12 @@
 	{ '\xff', NULL, "option",
 	  /* Deprecated */
 	  0, "string", "reboot",
-	  "Fencing option (null, off, on, [reboot], status, list, monitor, metadata)",
+	  "Fencing option (null, off, on, [reboot], status, list, list-status, monitor, validate-all, metadata)",
 	  assign_op },
 
 	{ 'o', "-o <operation>", "action",
 	  0, "string", "reboot",
-	  "Fencing action (null, off, on, [reboot], status, list, monitor, metadata)",
+	  "Fencing action (null, off, on, [reboot], status, list, list-status, monitor, validate-all, metadata)",
 	  assign_op },
 
 	{ 'H', "-H <domain>", "port",
@@ -799,7 +801,8 @@
 	printf("\t<action name=\"metadata\" />\n");	
 	printf("\t<action name=\"status\" />\n");	
 	printf("\t<action name=\"monitor\" />\n");	
-	printf("\t<action name=\"list\" />\n");	
+	printf("\t<action name=\"list\" />\n");
+	printf("\t<action name=\"validate-all\" />\n");
 	printf("</actions>\n");
 	printf("</resource-agent>\n");
 }
diff -ur a/include/xvm.h b/include/xvm.h
--- a/include/xvm.h	2014-06-23 15:56:09.000000000 -0400
+++ b/include/xvm.h	2017-08-09 13:09:04.295571598 -0400
@@ -52,14 +52,15 @@
 #define DEFAULT_AUTH AUTH_SHA256
 
 typedef enum {
-	FENCE_NULL   = 0x0,	
-	FENCE_OFF    = 0x1,		/* Turn the VM off */
-	FENCE_REBOOT = 0x2,		/* Hit the reset button */
-	FENCE_ON     = 0x3,		/* Turn the VM on */
-	FENCE_STATUS = 0x4,		/* virtual machine status (off/on) */
-	FENCE_DEVSTATUS = 0x5,		/* Status of the fencing device */
-	FENCE_HOSTLIST = 0x6,		/* List VMs controllable */
-	FENCE_METADATA = 0x7
+	FENCE_NULL        = 0x0,
+	FENCE_OFF         = 0x1,		/* Turn the VM off */
+	FENCE_REBOOT      = 0x2,		/* Hit the reset button */
+	FENCE_ON          = 0x3,		/* Turn the VM on */
+	FENCE_STATUS      = 0x4,		/* virtual machine status (off/on) */
+	FENCE_DEVSTATUS   = 0x5,		/* Status of the fencing device */
+	FENCE_HOSTLIST    = 0x6,		/* List VMs controllable */
+	FENCE_METADATA    = 0x7,        /* Print fence agent metadata */
+	FENCE_VALIDATEALL = 0x8         /* Validate command-line or stdin arguments and exit */
 } fence_cmd_t;
 
 #define DEFAULT_TTL 4
diff -ur a/man/fence_virt.8 b/man/fence_virt.8
--- a/man/fence_virt.8	2014-06-23 15:56:09.000000000 -0400
+++ b/man/fence_virt.8	2017-08-09 13:09:04.295571598 -0400
@@ -145,7 +145,7 @@
 .TP
 .B action
 . 
-Fencing action (null, off, on, reboot, status, monitor, list, or metadata) (Default Value: reboot).  See the FENCING ACTIONS section.
+Fencing action (null, off, on, reboot, status, monitor, list, list-status, validate-all, or metadata) (Default Value: reboot).  See the FENCING ACTIONS section.
 	
 .TP
 .B timeout
@@ -255,6 +255,10 @@
 on all backends).
 
 .TP
+\fBvalidate-all\fP
+Validate arguments given on either the command line or standard input. If validation fails, the fence agent will exit with code 1, otherwise it will exit with code 0.
+
+.TP
 \fBmetadata \fP
 Print XML metadata to standard output.