Blame SOURCES/bz1447700-virt_add_support_for_the_validate_all_status.patch

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