summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/include/ctdb_private.h1
-rw-r--r--ctdb/server/ctdbd.c16
-rw-r--r--ctdb/tcp/tcp_connect.c58
3 files changed, 21 insertions, 54 deletions
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 582a7677c05..152af64f684 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -501,7 +501,6 @@ struct ctdb_context {
pid_t recoverd_pid;
pid_t syslogd_pid;
bool done_startup;
- const char *node_ip;
struct ctdb_monitor_state *monitor;
struct ctdb_log_state *log;
int start_as_disabled;
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index ddda8ffbe21..bcc950266a4 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -41,7 +41,6 @@ static struct {
const char *db_dir_state;
const char *public_interface;
const char *single_public_ip;
- const char *node_ip;
int valgrinding;
int nosetsched;
int use_syslog;
@@ -126,7 +125,6 @@ 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"},
{ "notification-script", 0, POPT_ARG_STRING, &options.notification_script, 0, "notification script", "filename" },
{ "debug-hung-script", 0, POPT_ARG_STRING, &options.debug_hung_script, 0, "debug script for hung eventscripts", "filename" },
{ "listen", 0, POPT_ARG_STRING, &options.myaddress, 0, "address to listen on", "address" },
@@ -247,20 +245,6 @@ int main(int argc, const char *argv[])
/* tell ctdb what nodes are available */
ctdb_load_nodes_file(ctdb);
- /* if a node-ip was specified, verify that it exists in the
- nodes file
- */
- if (options.node_ip != NULL) {
- DEBUG(DEBUG_NOTICE,("IP for this node is %s\n", options.node_ip));
- ret = ctdb_ip_to_nodeid(ctdb, options.node_ip);
- if (ret == -1) {
- DEBUG(DEBUG_ALERT,("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(DEBUG_NOTICE,("This is node %d\n", ret));
- }
-
if (options.db_dir) {
ret = ctdb_set_tdb_dir(ctdb, options.db_dir);
if (ret == -1) {
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index c94b88f6709..26a280e30ba 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -290,45 +290,32 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
return -1;
}
- /* We only need to serialize this if we dont yet know the node ip */
- if (!ctdb->node_ip) {
- /* in order to ensure that we don't get two nodes with the
- same adddress, we must make the bind() and listen() calls
- atomic. The SO_REUSEADDR setsockopt only prevents double
- binds if the first socket is in LISTEN state */
- lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666);
- if (lock_fd == -1) {
- DEBUG(DEBUG_CRIT,("Unable to open %s\n", lock_path));
- return -1;
- }
+ /* in order to ensure that we don't get two nodes with the
+ same adddress, we must make the bind() and listen() calls
+ atomic. The SO_REUSEADDR setsockopt only prevents double
+ binds if the first socket is in LISTEN state */
+ lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666);
+ if (lock_fd == -1) {
+ DEBUG(DEBUG_CRIT,("Unable to open %s\n", lock_path));
+ return -1;
+ }
- lock.l_type = F_WRLCK;
- lock.l_whence = SEEK_SET;
- lock.l_start = 0;
- lock.l_len = 1;
- lock.l_pid = 0;
+ lock.l_type = F_WRLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = 0;
+ lock.l_len = 1;
+ lock.l_pid = 0;
- if (fcntl(lock_fd, F_SETLKW, &lock) != 0) {
- DEBUG(DEBUG_CRIT,("Unable to lock %s\n", lock_path));
- close(lock_fd);
- return -1;
- }
+ if (fcntl(lock_fd, F_SETLKW, &lock) != 0) {
+ DEBUG(DEBUG_CRIT,("Unable to lock %s\n", lock_path));
+ close(lock_fd);
+ return -1;
}
for (i=0; i < ctdb->num_nodes; i++) {
if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
continue;
}
-
- /* if node_ip is specified we will only try to bind to that
- ip.
- */
- if (ctdb->node_ip != NULL) {
- if (strcmp(ctdb->node_ip, ctdb->nodes[i]->address.address)) {
- continue;
- }
- }
-
ZERO_STRUCT(sock);
if (ctdb_tcp_get_address(ctdb,
ctdb->nodes[i]->address.address,
@@ -411,15 +398,12 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
ctdb_listen_event, ctdb);
tevent_fd_set_auto_close(fde);
- if (!ctdb->node_ip) {
- close(lock_fd);
- }
+ close(lock_fd);
+
return 0;
failed:
- if (!ctdb->node_ip) {
- close(lock_fd);
- }
+ close(lock_fd);
close(ctcp->listen_fd);
ctcp->listen_fd = -1;
return -1;