mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
From M Dietz,
Add back the controls to enable/disable monitoring we used to have for debugging but removed a while ago (This used to be ctdb commit 8477f6a079e2beb8c09c19702733c4e17f5032fe)
This commit is contained in:
parent
d53424731f
commit
2863d2cfd1
@ -1979,7 +1979,7 @@ int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint
|
||||
CTDB_CONTROL_GET_MONMODE, 0, tdb_null,
|
||||
NULL, NULL, &res, &timeout, NULL);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getrecmode failed\n"));
|
||||
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getmonmode failed\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1988,6 +1988,51 @@ int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
set the monitoring mode of a remote node to active
|
||||
*/
|
||||
int ctdb_ctrl_enable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
ret = ctdb_control(ctdb, destnode, 0,
|
||||
CTDB_CONTROL_ENABLE_MONITOR, 0, tdb_null,
|
||||
NULL, NULL,NULL, &timeout, NULL);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for enable_monitor failed\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
set the monitoring mode of a remote node to disable
|
||||
*/
|
||||
int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
ret = ctdb_control(ctdb, destnode, 0,
|
||||
CTDB_CONTROL_DISABLE_MONITOR, 0, tdb_null,
|
||||
NULL, NULL, NULL, &timeout, NULL);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for disable_monitor failed\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
sent to a node to make it take over an ip address
|
||||
*/
|
||||
|
@ -387,6 +387,17 @@ int ctdb_ctrl_setrecmode(struct ctdb_context *ctdb, struct timeval timeout, uint
|
||||
*/
|
||||
int ctdb_ctrl_getmonmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t *monmode);
|
||||
|
||||
/*
|
||||
set the monitoring mode of a remote node to active
|
||||
*/
|
||||
int ctdb_ctrl_enable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
|
||||
|
||||
/*
|
||||
set the monitoring mode of a remote node to disabled
|
||||
*/
|
||||
int ctdb_ctrl_disable_monmode(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
|
||||
|
||||
|
||||
/*
|
||||
get the recovery master of a remote node
|
||||
*/
|
||||
|
@ -497,6 +497,8 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
|
||||
CTDB_CONTROL_RELOAD_NODES_FILE = 72,
|
||||
CTDB_CONTROL_GET_RECLOCK_FILE = 73,
|
||||
CTDB_CONTROL_TRY_DELETE_RECORDS = 74,
|
||||
CTDB_CONTROL_ENABLE_MONITOR = 75,
|
||||
CTDB_CONTROL_DISABLE_MONITOR = 76,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -255,7 +255,18 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
return ctdb_control_set_recmode(ctdb, c, indata, async_reply, errormsg);
|
||||
|
||||
case CTDB_CONTROL_GET_MONMODE:
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
return ctdb_monitoring_mode(ctdb);
|
||||
|
||||
case CTDB_CONTROL_ENABLE_MONITOR:
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
ctdb_enable_monitoring(ctdb);
|
||||
return 0;
|
||||
|
||||
case CTDB_CONTROL_DISABLE_MONITOR:
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
ctdb_disable_monitoring(ctdb);
|
||||
return 0;
|
||||
|
||||
case CTDB_CONTROL_SHUTDOWN:
|
||||
ctdb_stop_recoverd(ctdb);
|
||||
|
@ -900,6 +900,43 @@ static int control_getmonmode(struct ctdb_context *ctdb, int argc, const char **
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
disable monitoring on a node
|
||||
*/
|
||||
static int control_disable_monmode(struct ctdb_context *ctdb, int argc, const char **argv)
|
||||
{
|
||||
|
||||
int ret;
|
||||
|
||||
ret = ctdb_ctrl_disable_monmode(ctdb, TIMELIMIT(), options.pnn);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR, ("Unable to disable monmode on node %u\n", options.pnn));
|
||||
return ret;
|
||||
}
|
||||
printf("Monitoring mode:%s\n","DISABLED");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
enable monitoring on a node
|
||||
*/
|
||||
static int control_enable_monmode(struct ctdb_context *ctdb, int argc, const char **argv)
|
||||
{
|
||||
|
||||
int ret;
|
||||
|
||||
ret = ctdb_ctrl_enable_monmode(ctdb, TIMELIMIT(), options.pnn);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR, ("Unable to enable monmode on node %u\n", options.pnn));
|
||||
return ret;
|
||||
}
|
||||
printf("Monitoring mode:%s\n","ACTIVE");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
display remote list of keys/data for a db
|
||||
*/
|
||||
@ -1386,6 +1423,8 @@ static const struct {
|
||||
{ "getdbmap", control_getdbmap, true, "show the database map" },
|
||||
{ "catdb", control_catdb, true, "dump a database" , "<dbname>"},
|
||||
{ "getmonmode", control_getmonmode, true, "show monitoring mode" },
|
||||
{ "disablemonitor", control_disable_monmode, true, "set monitoring mode to DISABLE" },
|
||||
{ "enablemonitor", control_enable_monmode, true, "set monitoring mode to ACTIVE" },
|
||||
{ "setdebug", control_setdebug, true, "set debug level", "<EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|DEBUG>" },
|
||||
{ "getdebug", control_getdebug, true, "get debug level" },
|
||||
{ "attach", control_attach, true, "attach to a database", "<dbname>" },
|
||||
|
Loading…
Reference in New Issue
Block a user