1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdbd: Remove debug option --node-ip, use --listen instead

This effectively reverts d96cb02c2c24f9eabbc53d3d38e90dea49cff3e0

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 496387a585b2c5778c808cf02b8e1435abde4c3e)
This commit is contained in:
Martin Schwenke 2012-12-03 15:44:12 +11:00 committed by Amitay Isaacs
parent 5cf98c80ff
commit 80a2bb84e7
3 changed files with 21 additions and 54 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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;