From 9e73dc87ccfbb148af4cd83ae1415fcb7b6e2f23 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 26 Nov 2007 10:52:55 +1100 Subject: Add a --node-ip argument so that one can specify which ip address a specific instance of ctdbd should bind to. This helps when running a "virtual" cluster on a single machine where all instcances bind to different alias interfaces. If --node-ip is specified, then we will only try to bind to this ip address only. Othervise we fall back to the original method trying the ip addresses in /etc/ctdb/nodes one by one until we find one we can bind to. No variable in /etc/sysconfig/ctdb added since this parameter only makes sense in a virtual test/debug cluster. (This used to be ctdb commit d96cb02c2c24f9eabbc53d3d38e90dea49cff3e0) --- ctdb/server/ctdb_server.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ctdb/server/ctdb_server.c') diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c index dddf90753bd..2a80798dd93 100644 --- a/ctdb/server/ctdb_server.c +++ b/ctdb/server/ctdb_server.c @@ -34,6 +34,23 @@ int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport) return 0; } +/* + Check whether an ip is a valid node ip + Returns the node id for this ip address or -1 +*/ +int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip) +{ + int nodeid; + + for (nodeid=0;nodeidnum_nodes;nodeid++) { + if (!strcmp(ctdb->nodes[nodeid]->address.address, nodeip)) { + return nodeid; + } + } + + return -1; +} + /* choose the recovery lock file */ -- cgit