mirror of
https://github.com/samba-team/samba.git
synced 2025-01-24 02:04:21 +03:00
eventscript: expost ctdb_ban_self()
eventscript.c uses this now, but our next patch makes others use it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit a305cb7743c24386e464f6b2efab7e2108bb1e7e)
This commit is contained in:
parent
0dd46797d6
commit
5190932507
@ -1535,6 +1535,7 @@ int32_t ctdb_control_disable_script(struct ctdb_context *ctdb, TDB_DATA indata);
|
||||
int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata);
|
||||
int32_t ctdb_control_get_ban_state(struct ctdb_context *ctdb, TDB_DATA *outdata);
|
||||
int32_t ctdb_control_set_db_priority(struct ctdb_context *ctdb, TDB_DATA indata);
|
||||
void ctdb_ban_self(struct ctdb_context *ctdb);
|
||||
|
||||
int32_t ctdb_control_register_notify(struct ctdb_context *ctdb, uint32_t client_id, TDB_DATA indata);
|
||||
|
||||
|
@ -119,3 +119,18 @@ int32_t ctdb_control_get_ban_state(struct ctdb_context *ctdb, TDB_DATA *outdata)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Routine to ban ourselves for a while when trouble strikes. */
|
||||
void ctdb_ban_self(struct ctdb_context *ctdb)
|
||||
{
|
||||
TDB_DATA data;
|
||||
struct ctdb_ban_time bantime;
|
||||
|
||||
bantime.pnn = ctdb->pnn;
|
||||
bantime.time = ctdb->tunable.recovery_ban_period;
|
||||
|
||||
data.dsize = sizeof(bantime);
|
||||
data.dptr = (uint8_t *)&bantime;
|
||||
|
||||
ctdb_control_set_ban_state(ctdb, data);
|
||||
}
|
||||
|
@ -623,21 +623,6 @@ static void ctdb_event_script_handler(struct event_context *ev, struct fd_event
|
||||
talloc_free(state);
|
||||
}
|
||||
|
||||
static void ctdb_ban_self(struct ctdb_context *ctdb, uint32_t ban_period)
|
||||
{
|
||||
TDB_DATA data;
|
||||
struct ctdb_ban_time bantime;
|
||||
|
||||
bantime.pnn = ctdb->pnn;
|
||||
bantime.time = ban_period;
|
||||
|
||||
data.dsize = sizeof(bantime);
|
||||
data.dptr = (uint8_t *)&bantime;
|
||||
|
||||
ctdb_control_set_ban_state(ctdb, data);
|
||||
}
|
||||
|
||||
|
||||
/* called when child times out */
|
||||
static void ctdb_event_script_timeout(struct event_context *ev, struct timed_event *te,
|
||||
struct timeval t, void *p)
|
||||
@ -680,7 +665,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
|
||||
*/
|
||||
DEBUG(DEBUG_ERR, (__location__ " eventscript for NON-monitor/NON-startup event timedout. Immediately banning ourself for %d seconds\n", ctdb->tunable.recovery_ban_period));
|
||||
|
||||
ctdb_ban_self(ctdb, ctdb->tunable.recovery_ban_period);
|
||||
ctdb_ban_self(ctdb);
|
||||
|
||||
state->cb_status = -ETIME;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user