MXS-1446: Add execution of dummy failover command
The failover command is simulated by executing a call to /usr/bin/echo with all possible monitor parameters. This allows testing of the failover mechanism without actually using the failover command.
This commit is contained in:
@ -244,6 +244,7 @@ const char *config_monitor_params[] =
|
||||
CN_MONITOR_INTERVAL,
|
||||
CN_JOURNAL_MAX_AGE,
|
||||
CN_SCRIPT_TIMEOUT,
|
||||
CN_FAILOVER,
|
||||
CN_FAILOVER_TIMEOUT,
|
||||
CN_BACKEND_CONNECT_TIMEOUT,
|
||||
CN_BACKEND_READ_TIMEOUT,
|
||||
@ -3188,6 +3189,23 @@ int create_new_monitor(CONFIG_CONTEXT *context, CONFIG_CONTEXT *obj, HASHTABLE*
|
||||
obj->object, CN_SCRIPT_TIMEOUT, DEFAULT_SCRIPT_TIMEOUT);
|
||||
}
|
||||
|
||||
char *failover = config_get_value(obj->parameters, CN_FAILOVER);
|
||||
if (failover)
|
||||
{
|
||||
int val = config_truth_value(failover);
|
||||
|
||||
if (val != -1)
|
||||
{
|
||||
monitorSetFailover(monitor, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
error_count++;
|
||||
MXS_NOTICE("Invalid '%s' parameter for monitor '%s'",
|
||||
CN_FAILOVER, obj->object);
|
||||
}
|
||||
}
|
||||
|
||||
char *failover_timeout = config_get_value(obj->parameters, CN_FAILOVER_TIMEOUT);
|
||||
if (failover_timeout)
|
||||
{
|
||||
|
Reference in New Issue
Block a user