summaryrefslogtreecommitdiffstats
path: root/ctdb/server/ctdbd.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@ronnie>2007-11-26 10:52:55 +1100
committerRonnie Sahlberg <sahlberg@ronnie>2007-11-26 10:52:55 +1100
commit9e73dc87ccfbb148af4cd83ae1415fcb7b6e2f23 (patch)
tree92a0a21fb0c2443723d3587032a79c4656ed1837 /ctdb/server/ctdbd.c
parent0597be338660ce9d80e9011a7a7158dcb66be272 (diff)
downloadsamba-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/ctdbd.c')
-rw-r--r--ctdb/server/ctdbd.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index eaf79a0ed7d..ba0eac42fb8 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -50,6 +50,7 @@ static struct {
const char *db_dir_persistent;
const char *public_interface;
const char *single_public_ip;
+ const char *node_ip;
int no_setsched;
} options = {
.nlist = ETCDIR "/ctdb/nodes",
@@ -110,6 +111,7 @@ int main(int argc, const char *argv[])
{ "event-script-dir", 0, POPT_ARG_STRING, &options.event_script_dir, 0, "event script directory", "dirname" },
{ "logfile", 0, POPT_ARG_STRING, &options.logfile, 0, "log file location", "filename" },
{ "nlist", 0, POPT_ARG_STRING, &options.nlist, 0, "node list file", "filename" },
+ { "node-ip", 0, POPT_ARG_STRING, &options.node_ip, 0, "node ip", "ip-address"},
{ "listen", 0, POPT_ARG_STRING, &options.myaddress, 0, "address to listen on", "address" },
{ "transport", 0, POPT_ARG_STRING, &options.transport, 0, "protocol transport", NULL },
{ "dbdir", 0, POPT_ARG_STRING, &options.db_dir, 0, "directory for the tdb files", NULL },
@@ -198,6 +200,20 @@ int main(int argc, const char *argv[])
exit(1);
}
+ /* if a node-ip was specified, verify that it exists in the
+ nodes file
+ */
+ if (options.node_ip != NULL) {
+ DEBUG(0,("IP for this node is %s\n", options.node_ip));
+ ret = ctdb_ip_to_nodeid(ctdb, options.node_ip);
+ if (ret == -1) {
+ DEBUG(0,("The specified node-ip:%s is not a valid node address. Exiting.\n", options.node_ip));
+ exit(1);
+ }
+ ctdb->node_ip = options.node_ip;
+ DEBUG(0,("This is node %d\n", ret));
+ }
+
if (options.db_dir) {
ret = ctdb_set_tdb_dir(ctdb, options.db_dir);
if (ret == -1) {