diff options
author | Ronnie Sahlberg <sahlberg@ronnie> | 2007-11-26 10:52:55 +1100 |
---|---|---|
committer | Ronnie Sahlberg <sahlberg@ronnie> | 2007-11-26 10:52:55 +1100 |
commit | 9e73dc87ccfbb148af4cd83ae1415fcb7b6e2f23 (patch) | |
tree | 92a0a21fb0c2443723d3587032a79c4656ed1837 /ctdb/server/ctdb_server.c | |
parent | 0597be338660ce9d80e9011a7a7158dcb66be272 (diff) | |
download | samba-9e73dc87ccfbb148af4cd83ae1415fcb7b6e2f23.tar.gz samba-9e73dc87ccfbb148af4cd83ae1415fcb7b6e2f23.tar.xz samba-9e73dc87ccfbb148af4cd83ae1415fcb7b6e2f23.zip |
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)
Diffstat (limited to 'ctdb/server/ctdb_server.c')
-rw-r--r-- | ctdb/server/ctdb_server.c | 17 |
1 files changed, 17 insertions, 0 deletions
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 @@ -35,6 +35,23 @@ int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport) } /* + 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;nodeid<ctdb->num_nodes;nodeid++) { + if (!strcmp(ctdb->nodes[nodeid]->address.address, nodeip)) { + return nodeid; + } + } + + return -1; +} + +/* choose the recovery lock file */ int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file) |