tevent_context_init_stub(x)
#define ctdb_ctrl_getnodemap(ctdb, timelimit, pnn, tmp_ctx, nodemap) \
ctdb_ctrl_getnodemap_stub(ctdb, timelimit, pnn, tmp_ctx, nodemap)
+#define ctdb_ctrl_getnodesfile(ctdb, timeout, destnode, mem_ctx, nodemap) \
+ ctdb_ctrl_getnodesfile_stub(ctdb, timeout, destnode, mem_ctx, nodemap)
#define ctdb_ctrl_get_ifaces(ctdb, timelimit, pnn, tmp_ctx, ifaces) \
ctdb_ctrl_get_ifaces_stub(ctdb, timelimit, pnn, tmp_ctx, ifaces)
#define ctdb_ctrl_getpnn(ctdb, timelimit, pnn) \
#include "common/cmdline.c"
#undef ctdb_ctrl_getnodemap
+#undef ctdb_ctrl_getnodesfile
#undef ctdb_ctrl_get_ifaces
#undef ctdb_ctrl_getpnn
#undef ctdb_ctrl_getrecmode
int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
+int ctdb_ctrl_getnodesfile(struct ctdb_context *ctdb,
+ struct timeval timeout, uint32_t destnode,
+ TALLOC_CTX *mem_ctx,
+ struct ctdb_node_map **nodemap);
int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx,
return ret;
}
+int
+ctdb_ctrl_getnodesfile_stub(struct ctdb_context *ctdb,
+ struct timeval timeout, uint32_t destnode,
+ TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap)
+{
+ char *v, *f;
+
+ /* If there's an environment variable for a node-specific file
+ * then use it. Otherwise use the global file. */
+ v = talloc_asprintf(mem_ctx, "CTDB_NODES_%u", destnode);
+ f = getenv(v);
+ if (f == NULL) {
+ f = getenv("CTDB_NODES");
+ }
+
+ *nodemap = ctdb_read_nodes_file(mem_ctx, f);
+
+ return *nodemap == NULL ? -1 : 0;
+}
+
int
ctdb_ctrl_getvnnmap_stub(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
DEBUG(DEBUG_NOTICE, ("Fake reload public IPs on node %u\n", pnn));
res = 0;
break;
+ case CTDB_CONTROL_GET_NODES_FILE: {
+ struct ctdb_node_map *nodemap;
+ res = ctdb_ctrl_getnodesfile_stub(ctdb, timeout, pnn,
+ tmp_ctx, &nodemap);
+ if (res == 0) {
+ outdata.dsize = talloc_get_size(nodemap);
+ outdata.dptr = (uint8_t *) nodemap;
+ }
+ }
+ break;
default:
DEBUG(DEBUG_ERR, (__location__ " Control not implemented %u\n",
opcode));