bool banning_credits_on_fail)
{
uint32_t *nodes = NULL;
- struct srvid_request dtr;
+ struct srvid_request_data dtr;
TDB_DATA data;
int i;
uint32_t *rebalance_nodes = rec->force_rebalance_nodes;
{
struct ctdb_recoverd *rec = talloc_get_type(private_data,
struct ctdb_recoverd);
- struct srvid_request *r;
+ struct srvid_request_data *r;
uint32_t timeout;
TDB_DATA result;
int32_t ret = 0;
/* Validate input data */
- if (data.dsize != sizeof(struct srvid_request)) {
+ if (data.dsize != sizeof(struct srvid_request_data)) {
DEBUG(DEBUG_ERR,(__location__ " Wrong size for data :%lu "
"expecting %lu\n", (long unsigned)data.dsize,
(long unsigned)sizeof(struct srvid_request)));
return;
}
- r = (struct srvid_request *)data.dptr;
+ r = (struct srvid_request_data *)data.dptr;
timeout = r->data;
if (timeout == 0) {
done:
result.dsize = sizeof(int32_t);
result.dptr = (uint8_t *)&ret;
- srvid_request_reply(ctdb, r, result);
+ srvid_request_reply(ctdb, (struct srvid_request *)r, result);
}
/* Backward compatibility for this SRVID - call
struct ctdb_recoverd *rec = talloc_get_type(private_data,
struct ctdb_recoverd);
TDB_DATA data2;
- struct srvid_request *req;
+ struct srvid_request_data *req;
if (data.dsize != sizeof(uint32_t)) {
DEBUG(DEBUG_ERR,(__location__ " Wrong size for data :%lu "
return;
}
- req = talloc(ctdb, struct srvid_request);
+ req = talloc(ctdb, struct srvid_request_data);
CTDB_NO_MEMORY_VOID(ctdb, req);
req->srvid = 0; /* No reply */
* pass in the srvid_request structure - pass 0 if this isn't needed.
*/
static int srvid_broadcast(struct ctdb_context *ctdb,
- uint64_t srvid, uint32_t arg,
+ uint64_t srvid, uint32_t *arg,
const char *srvid_str, bool wait_for_all)
{
int ret;
TDB_DATA data;
+ uint32_t pnn;
+ uint64_t reply_srvid;
struct srvid_request request;
+ struct srvid_request_data request_data;
struct srvid_reply_handler_data reply_data;
struct timeval tv;
timeval_current_ofs(1, 0),
ctdb_every_second, ctdb);
- request.pnn = ctdb_get_pnn(ctdb);
- request.srvid = getpid();
- request.data = arg;
+ pnn = ctdb_get_pnn(ctdb);
+ reply_srvid = getpid();
+
+ if (arg == NULL) {
+ request.pnn = pnn;
+ request.srvid = reply_srvid;
+
+ data.dptr = (uint8_t *)&request;
+ data.dsize = sizeof(request);
+ } else {
+ request_data.pnn = pnn;
+ request_data.srvid = reply_srvid;
+ request_data.data = *arg;
+
+ data.dptr = (uint8_t *)&request_data;
+ data.dsize = sizeof(request_data);
+ }
/* Register message port for reply from recovery master */
- ctdb_client_set_message_handler(ctdb, request.srvid,
+ ctdb_client_set_message_handler(ctdb, reply_srvid,
srvid_broadcast_reply_handler,
&reply_data);
- data.dptr = (uint8_t *)&request;
- data.dsize = sizeof(request);
-
reply_data.wait_for_all = wait_for_all;
reply_data.nodes = NULL;
reply_data.srvid_str = srvid_str;
goto again;
}
- ctdb_client_remove_message_handler(ctdb, request.srvid, &reply_data);
+ ctdb_client_remove_message_handler(ctdb, reply_srvid, &reply_data);
talloc_free(reply_data.nodes);
static int ipreallocate(struct ctdb_context *ctdb)
{
- return srvid_broadcast(ctdb, CTDB_SRVID_TAKEOVER_RUN, 0,
+ return srvid_broadcast(ctdb, CTDB_SRVID_TAKEOVER_RUN, NULL,
"IP reallocation", false);
}
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
uint32_t *nodes;
uint32_t pnn_mode;
+ uint32_t timeout;
int ret;
assert_single_node_only();
* there are disconnected nodes. However, this should
* probably be left up to the administrator.
*/
- srvid_broadcast(ctdb, CTDB_SRVID_DISABLE_TAKEOVER_RUNS, LONGTIMEOUT,
+ timeout = LONGTIMEOUT;
+ srvid_broadcast(ctdb, CTDB_SRVID_DISABLE_TAKEOVER_RUNS, &timeout,
"Disable takeover runs", true);
/* Now tell all the desired nodes to reload their public IPs.
/* It isn't strictly necessary to wait until takeover runs are
* re-enabled but doing so can't hurt.
*/
- srvid_broadcast(ctdb, CTDB_SRVID_DISABLE_TAKEOVER_RUNS, 0,
+ timeout = 0;
+ srvid_broadcast(ctdb, CTDB_SRVID_DISABLE_TAKEOVER_RUNS, &timeout,
"Enable takeover runs", true);
ipreallocate(ctdb);