return 0;
}
+
+/*
+ get all tunables
+ */
+int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
+ struct timeval timeout,
+ uint32_t destnode,
+ struct ctdb_tunable *tunables)
+{
+ TDB_DATA outdata;
+ int ret;
+ int32_t res;
+
+ ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_ALL_TUNABLES, 0, tdb_null, ctdb,
+ &outdata, &res, &timeout, NULL);
+ if (ret != 0 || res != 0) {
+ DEBUG(0,(__location__ " ctdb_control for get all tunables failed\n"));
+ return -1;
+ }
+
+ if (outdata.dsize != sizeof(*tunables)) {
+ DEBUG(0,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
+ outdata.dsize, sizeof(*tunables)));
+ return -1;
+ }
+
+ *tunables = *(struct ctdb_tunable *)outdata.dptr;
+ talloc_free(outdata.dptr);
+ return 0;
+}
return 0;
}
+ case CTDB_CONTROL_GET_ALL_TUNABLES: {
+ CHECK_CONTROL_DATA_SIZE(0);
+ outdata->dptr = (uint8_t *)&ctdb->tunable;
+ outdata->dsize = sizeof(ctdb->tunable);
+ return 0;
+ }
+
case CTDB_CONTROL_DUMP_MEMORY: {
CHECK_CONTROL_DATA_SIZE(0);
talloc_report_full(ctdb, stdout);
ctdb_wait_timeout(ctdb, ctdb->tunable.recover_interval);
/* get relevant tunables */
- ctdb_ctrl_get_tunable(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE,
- "RecoverTimeout", &ctdb->tunable.recover_timeout);
- ctdb_ctrl_get_tunable(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE,
- "RecoverInterval", &ctdb->tunable.recover_interval);
- ctdb_ctrl_get_tunable(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE,
- "ElectionTimeout", &ctdb->tunable.election_timeout);
- ctdb_ctrl_get_tunable(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE,
- "TakeoverTimeout", &ctdb->tunable.takeover_timeout);
- ctdb_ctrl_get_tunable(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE,
- "RecoveryGracePeriod", &ctdb->tunable.recovery_grace_period);
- ctdb_ctrl_get_tunable(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE,
- "RecoveryBanPeriod", &ctdb->tunable.recovery_ban_period);
+ ret = ctdb_ctrl_get_all_tunables(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, &ctdb->tunable);
+ if (ret != 0) {
+ DEBUG(0,("Failed to get tunables - retrying\n"));
+ goto again;
+ }
vnn = ctdb_ctrl_getvnn(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
if (vnn == (uint32_t)-1) {
CTDB_CONTROL_LIST_TUNABLES = 50,
CTDB_CONTROL_GET_PUBLIC_IPS = 51,
CTDB_CONTROL_MODIFY_FLAGS = 52,
+ CTDB_CONTROL_GET_ALL_TUNABLES = 53,
};
/*
int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata);
+int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
+ struct timeval timeout,
+ uint32_t destnode,
+ struct ctdb_tunable *tunables);
+
#endif