mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
ctdbd: New control CTDB_CONTROL_GET_RUNSTATE
Also new client function ctdb_ctrl_get_runstate(). Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit dc4220e6f618cc688b3ca8e52bcb3eec6cb55bb1)
This commit is contained in:
parent
147f6bb4b8
commit
77671b9ef5
@ -1654,6 +1654,36 @@ int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode)
|
||||
return res;
|
||||
}
|
||||
|
||||
int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb,
|
||||
struct timeval timeout,
|
||||
uint32_t destnode,
|
||||
uint32_t *runstate)
|
||||
{
|
||||
TDB_DATA outdata;
|
||||
int32_t res;
|
||||
int ret;
|
||||
|
||||
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_RUNSTATE, 0,
|
||||
tdb_null, ctdb, &outdata, &res, &timeout, NULL);
|
||||
if (ret != 0 || res != 0) {
|
||||
DEBUG(DEBUG_ERR,("ctdb_control for get_runstate failed\n"));
|
||||
return ret != 0 ? ret : res;
|
||||
}
|
||||
|
||||
if (outdata.dsize != sizeof(uint32_t)) {
|
||||
DEBUG(DEBUG_ERR,("Invalid return data in get_runstate\n"));
|
||||
talloc_free(outdata.dptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (runstate != NULL) {
|
||||
*runstate = *(uint32_t *)outdata.dptr;
|
||||
}
|
||||
talloc_free(outdata.dptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
find the real path to a ltdb
|
||||
*/
|
||||
|
@ -295,6 +295,11 @@ int ctdb_ctrl_process_exists(struct ctdb_context *ctdb, uint32_t destnode, pid_t
|
||||
|
||||
int ctdb_ctrl_ping(struct ctdb_context *ctdb, uint32_t destnode);
|
||||
|
||||
int ctdb_ctrl_get_runstate(struct ctdb_context *ctdb,
|
||||
struct timeval timeout,
|
||||
uint32_t destnode,
|
||||
uint32_t *runstate);
|
||||
|
||||
int ctdb_ctrl_get_config(struct ctdb_context *ctdb);
|
||||
|
||||
int ctdb_ctrl_get_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, int32_t *level);
|
||||
|
@ -405,6 +405,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
|
||||
CTDB_CONTROL_TRAVERSE_ALL_EXT = 135,
|
||||
CTDB_CONTROL_RECEIVE_RECORDS = 136,
|
||||
CTDB_CONTROL_IPREALLOCATED = 137,
|
||||
CTDB_CONTROL_GET_RUNSTATE = 138,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -207,6 +207,13 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
return ctdb->num_clients;
|
||||
|
||||
case CTDB_CONTROL_GET_RUNSTATE:
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
outdata->dptr = (uint8_t *)&ctdb->runstate;
|
||||
outdata->dsize = sizeof(uint32_t);
|
||||
return 0;
|
||||
|
||||
|
||||
case CTDB_CONTROL_SET_DB_READONLY: {
|
||||
uint32_t db_id;
|
||||
struct ctdb_db_context *ctdb_db;
|
||||
|
Loading…
x
Reference in New Issue
Block a user