diff --git a/client/main.c b/client/main.c index 65ee8b1..3c72d08 100644 --- a/client/main.c +++ b/client/main.c @@ -56,10 +56,10 @@ main(int argc, char **argv) args_init(&args); if (!strcmp(basename(argv[0]), "fence_xvm")) { - my_options = "di:a:p:r:C:c:k:M:H:uo:t:?hV"; + my_options = "di:a:p:r:C:c:k:M:H:uo:t:?hVw:"; args.mode = MODE_MULTICAST; } else { - my_options = "dD:P:A:p:M:H:o:t:?hVT:C:c:k:"; + my_options = "dD:P:A:p:M:H:o:t:?hVT:C:c:k:w:"; args.mode = MODE_SERIAL; } @@ -119,6 +119,9 @@ main(int argc, char **argv) return 0; } + if (args.delay > 0) + sleep(args.delay); + switch(args.mode) { case MODE_MULTICAST: ret = mcast_fence_virt(&args); diff --git a/client/options.c b/client/options.c index 25d3c60..cd975ae 100644 --- a/client/options.c +++ b/client/options.c @@ -329,6 +329,18 @@ assign_timeout(fence_virt_args_t *args, struct arg_info *arg, char *value) } } +static inline void +assign_delay(fence_virt_args_t *args, struct arg_info *arg, char *value) +{ + if (!value) + return; + + args->delay = atoi(value); + if (args->timeout <= 0) { + printf("Invalid delay: '%s'\n", value); + args->flags |= F_ERR; + } +} static inline void assign_help(fence_virt_args_t *args, struct arg_info *arg, char *value) @@ -505,6 +517,11 @@ static struct arg_info _arg_info[] = { "URI for Hypervisor (default: auto detect)", assign_uri }, + { 'w', "-w ", "delay", + 0, "string", "0", + "Fencing delay (in seconds; default=0)", + assign_delay }, + { 'V', "-V", NULL, 0, "boolean", "0", "Display version and exit", diff --git a/include/options.h b/include/options.h index 2e0d764..2b09ad3 100644 --- a/include/options.h +++ b/include/options.h @@ -45,6 +45,7 @@ typedef struct { client_mode_t mode; int debug; int timeout; + int delay; int retr_time; arg_flags_t flags; diff --git a/man/fence_virt.8 b/man/fence_virt.8 index 715f17a..57869da 100644 --- a/man/fence_virt.8 +++ b/man/fence_virt.8 @@ -44,6 +44,11 @@ Fencing action (null, off, on, reboot, status, monitor, list, or metadata) (Defa . Fencing timeout (in seconds) (Default Value: 30) +.TP +.B -w +. +Fencing delay (in seconds). The fence agent will wait the specified number of seconds before attempting a fencing operation. (Default Value: 0) + .SH MULTICAST PARAMETERS These parameters are used only when using fence_virt in multicast mode (e.g. by running fence_xvm).