Blame SOURCES/add-a-delay-w-option.patch

54259b
diff -ur a/client/main.c b/client/main.c
54259b
--- a/client/main.c	2010-01-15 08:03:56.000000000 -0500
54259b
+++ b/client/main.c	2012-10-15 14:28:43.430961223 -0400
54259b
@@ -56,10 +56,10 @@
54259b
 
54259b
 	args_init(&args);
54259b
 	if (!strcmp(basename(argv[0]), "fence_xvm")) {
54259b
-       		my_options = "di:a:p:r:C:c:k:M:H:uo:t:?hV";
54259b
+       		my_options = "di:a:p:r:C:c:k:M:H:uo:t:?hVw:";
54259b
 		args.mode = MODE_MULTICAST;
54259b
 	} else {
54259b
-       		my_options = "dD:P:A:p:M:H:o:t:?hV";
54259b
+       		my_options = "dD:P:A:p:M:H:o:t:?hVw:";
54259b
 		args.mode = MODE_SERIAL;
54259b
 	}
54259b
 
54259b
@@ -115,6 +115,9 @@
54259b
 		return 0;
54259b
 	}
54259b
 
54259b
+	if (args.delay > 0)
54259b
+		sleep(args.delay);
54259b
+
54259b
 	switch(args.mode) {
54259b
 	case MODE_MULTICAST:
54259b
 		ret = mcast_fence_virt(&args);
54259b
diff -ur a/client/options.c b/client/options.c
54259b
--- a/client/options.c	2011-09-20 11:19:56.000000000 -0400
54259b
+++ b/client/options.c	2012-10-15 14:27:00.034407993 -0400
54259b
@@ -318,6 +318,18 @@
54259b
 	}
54259b
 }
54259b
 
54259b
+static inline void
54259b
+assign_delay(fence_virt_args_t *args, struct arg_info *arg, char *value)
54259b
+{
54259b
+	if (!value)
54259b
+		return;
54259b
+
54259b
+	args->delay = atoi(value);
54259b
+	if (args->timeout <= 0) {
54259b
+		printf("Invalid delay: '%s'\n", value);
54259b
+		args->flags |= F_ERR;
54259b
+	}
54259b
+}
54259b
 
54259b
 static inline void
54259b
 assign_help(fence_virt_args_t *args, struct arg_info *arg, char *value)
54259b
@@ -489,6 +501,11 @@
54259b
 	  "URI for Hypervisor (default: auto detect)",
54259b
 	  assign_uri },
54259b
 	  
54259b
+	{ 'w', "-w <delay>", "delay",
54259b
+	  0, "string", "0",
54259b
+	  "Fencing delay (in seconds; default=0)",
54259b
+	  assign_delay },
54259b
+
54259b
 	{ 'V', "-V", NULL,
54259b
 	  0, "boolean", "0",
54259b
  	  "Display version and exit", 
54259b
diff -ur a/include/options.h b/include/options.h
54259b
--- a/include/options.h	2010-01-14 16:38:19.000000000 -0500
54259b
+++ b/include/options.h	2012-10-15 14:27:00.034407993 -0400
54259b
@@ -44,6 +44,7 @@
54259b
 	client_mode_t mode;
54259b
 	int debug;
54259b
 	int timeout;
54259b
+	int delay;
54259b
 	int retr_time;
54259b
 	arg_flags_t flags;
54259b
 
54259b
diff -ur a/man/fence_virt.8 b/man/fence_virt.8
54259b
--- a/man/fence_virt.8	2012-10-15 14:27:51.869181554 -0400
54259b
+++ b/man/fence_virt.8	2012-10-15 14:27:00.034407993 -0400
54259b
@@ -44,6 +44,11 @@
54259b
 . 
54259b
 Fencing timeout (in seconds) (Default Value: 30)
54259b
 
54259b
+.TP
54259b
+.B -w
54259b
+. 
54259b
+Fencing delay (in seconds). The fence agent will wait the specified number of seconds before attempting a fencing operation. (Default Value: 0)
54259b
+
54259b
 .SH MULTICAST PARAMETERS
54259b
 These parameters are used only when using fence_virt in multicast mode
54259b
 (e.g. by running fence_xvm).