return 0;
}
+
+/*
+ stop a node
+ */
+int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
+{
+ int ret;
+
+ ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_STOP_NODE, 0, tdb_null,
+ ctdb, NULL, NULL, &timeout, NULL);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,("Failed to stop node\n"));
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ continue a node
+ */
+int ctdb_ctrl_continue_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
+{
+ int ret;
+
+ ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_CONTINUE_NODE, 0, tdb_null,
+ ctdb, NULL, NULL, &timeout, NULL);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,("Failed to continue node\n"));
+ return -1;
+ }
+
+ return 0;
+}
const char *get_debug_by_level(int32_t level);
int32_t get_debug_by_desc(const char *desc);
+int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
+int ctdb_ctrl_continue_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode);
#endif
#define NODE_FLAGS_BANNED 0x00000008 /* recovery daemon has banned the node */
#define NODE_FLAGS_DELETED 0x00000010 /* this node has been deleted */
#define NODE_FLAGS_STOPPED 0x00000020 /* this node has been stopped */
-#define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED|NODE_FLAGS_STOPPED)
-#define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED)
+#define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
+#define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
uint32_t flags;
/* used by the dead node monitoring */
CTDB_CONTROL_RECD_RECLOCK_LATENCY = 98,
CTDB_CONTROL_GET_RECLOCK_FILE = 99,
CTDB_CONTROL_SET_RECLOCK_FILE = 100,
+ CTDB_CONTROL_STOP_NODE = 101,
+ CTDB_CONTROL_CONTINUE_NODE = 102,
};
/*
int ctdb_log_event_script_output(struct ctdb_context *ctdb, char *str, uint16_t len);
int ctdb_ctrl_report_recd_lock_latency(struct ctdb_context *ctdb, struct timeval timeout, double latency);
+int32_t ctdb_control_stop_node(struct ctdb_context *ctdb);
+int32_t ctdb_control_continue_node(struct ctdb_context *ctdb);
+
#endif
ctdb->recovery_lock_file = talloc_strdup(ctdb, discard_const(indata.dptr));
}
return 0;
+ case CTDB_CONTROL_STOP_NODE:
+ CHECK_CONTROL_DATA_SIZE(0);
+ return ctdb_control_stop_node(ctdb);
+
+ case CTDB_CONTROL_CONTINUE_NODE:
+ CHECK_CONTROL_DATA_SIZE(0);
+ return ctdb_control_continue_node(ctdb);
+
default:
DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
return -1;
ctdb->recovery_master = ((uint32_t *)(&indata.dptr[0]))[0];
return 0;
}
+
+int32_t ctdb_control_stop_node(struct ctdb_context *ctdb)
+{
+ DEBUG(DEBUG_ERR,(__location__ " Stopping node\n"));
+ ctdb->nodes[ctdb->pnn]->flags |= NODE_FLAGS_STOPPED;
+
+ return 0;
+}
+
+int32_t ctdb_control_continue_node(struct ctdb_context *ctdb)
+{
+ DEBUG(DEBUG_ERR,(__location__ " Continue node\n"));
+ ctdb->nodes[ctdb->pnn]->flags &= ~NODE_FLAGS_STOPPED;
+
+ return 0;
+}
static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
- printf("IP Reallocation completed\n");
exit(0);
}
struct ctdb_node_map *nodemap=NULL;
do {
- ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_STOPPED, 0);
+ ret = ctdb_ctrl_stop_node(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
DEBUG(DEBUG_ERR, ("Unable to stop node %u\n", options.pnn));
return ret;
}
-
+
sleep(1);
/* read the nodemap and verify the change took effect */
struct ctdb_node_map *nodemap=NULL;
do {
- ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_STOPPED);
+ ret = ctdb_ctrl_continue_node(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(DEBUG_ERR, ("Unable to restart node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to continue node %u\n", options.pnn));
return ret;
}
-
+
sleep(1);
/* read the nodemap and verify the change took effect */