mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
add a control to read the current reclock file from a node
(This used to be ctdb commit ed6a4cbcdcbb4e0df83bec8be67c30288bf9bd41)
This commit is contained in:
parent
4a1a3652fe
commit
2b253c094c
@ -3651,3 +3651,26 @@ int ctdb_ctrl_report_recd_lock_latency(struct ctdb_context *ctdb, struct timeval
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
get the name of the reclock file
|
||||
*/
|
||||
int ctdb_ctrl_getreclock(struct ctdb_context *ctdb, struct timeval timeout,
|
||||
uint32_t destnode, TALLOC_CTX *mem_ctx,
|
||||
const char **name)
|
||||
{
|
||||
int ret;
|
||||
int32_t res;
|
||||
TDB_DATA data;
|
||||
|
||||
ret = ctdb_control(ctdb, destnode, 0,
|
||||
CTDB_CONTROL_GET_RECLOCK_FILE, 0, tdb_null,
|
||||
mem_ctx, &data, &res, &timeout, NULL);
|
||||
if (ret != 0 || res != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*name = discard_const(data.dptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -567,6 +567,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
|
||||
CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS = 96,
|
||||
CTDB_CONTROL_TRAVERSE_KILL = 97,
|
||||
CTDB_CONTROL_RECD_RECLOCK_LATENCY = 98,
|
||||
CTDB_CONTROL_GET_RECLOCK_FILE = 99,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -445,6 +445,13 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
CHECK_CONTROL_DATA_SIZE(sizeof(double));
|
||||
ctdb_reclock_latency(ctdb, "recd reclock", &ctdb->statistics.reclock.recd, *((double *)indata.dptr));
|
||||
return 0;
|
||||
case CTDB_CONTROL_GET_RECLOCK_FILE:
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
if (ctdb->recovery_lock_file != NULL) {
|
||||
outdata->dptr = discard_const(ctdb->recovery_lock_file);
|
||||
outdata->dsize = strlen(ctdb->recovery_lock_file) + 1;
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
|
||||
return -1;
|
||||
|
@ -2248,6 +2248,27 @@ static int control_getdebug(struct ctdb_context *ctdb, int argc, const char **ar
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
display reclock file of a node
|
||||
*/
|
||||
static int control_getreclock(struct ctdb_context *ctdb, int argc, const char **argv)
|
||||
{
|
||||
int ret;
|
||||
const char *reclock;
|
||||
|
||||
ret = ctdb_ctrl_getreclock(ctdb, TIMELIMIT(), options.pnn, ctdb, &reclock);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_ERR, ("Unable to get reclock file from node %u\n", options.pnn));
|
||||
return ret;
|
||||
} else {
|
||||
if (reclock == NULL) {
|
||||
printf("No reclock file used.\n");
|
||||
} else {
|
||||
printf("Reclock file:%s\n", reclock);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
set debug level on a node or all nodes
|
||||
@ -2991,6 +3012,7 @@ static const struct {
|
||||
{ "scriptstatus", control_scriptstatus, false, false, "show the status of the monitoring scripts"},
|
||||
{ "natgwlist", control_natgwlist, false, false, "show the nodes belonging to this natgw configuration"},
|
||||
{ "xpnn", control_xpnn, true, true, "find the pnn of the local node without talking to the daemon (unreliable)" },
|
||||
{ "getreclock", control_getreclock, false, false, "Show the reclock file of a node"},
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user