Add a delay (-w) option.
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
This commit is contained in:
parent
4c0038cb92
commit
fb992c7d0f
@ -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);
|
||||
|
@ -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>", "delay",
|
||||
0, "string", "0",
|
||||
"Fencing delay (in seconds; default=0)",
|
||||
assign_delay },
|
||||
|
||||
{ 'V', "-V", NULL,
|
||||
0, "boolean", "0",
|
||||
"Display version and exit",
|
||||
|
@ -45,6 +45,7 @@ typedef struct {
|
||||
client_mode_t mode;
|
||||
int debug;
|
||||
int timeout;
|
||||
int delay;
|
||||
int retr_time;
|
||||
arg_flags_t flags;
|
||||
|
||||
|
@ -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).
|
||||
|
Loading…
Reference in New Issue
Block a user