ctdbd: Pass the public address file location in ctdb context
authorMartin Schwenke <martin@meltin.net>
Mon, 21 Oct 2013 08:52:01 +0000 (19:52 +1100)
committerMartin Schwenke <martin@meltin.net>
Tue, 22 Oct 2013 04:37:54 +0000 (15:37 +1100)
No need to pass it as an extra argument to ctdb_start_daemon.

Also ensure options.public_address_list gets a nice static default.

Signed-off-by: Martin Schwenke <martin@meltin.net>
include/ctdb_private.h
server/ctdb_daemon.c
server/ctdbd.c

index 3430f9cd01dfe892e45dbe4338a7ad5c248a0c3e..f261867b3a32e25dd8a93427fb85cb99d1fb715c 100644 (file)
@@ -769,8 +769,7 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_db_context *ctdb_db,
 
 
 int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork,
-                     bool use_syslog,
-                     const char *public_address_list);
+                     bool use_syslog);
 struct ctdb_call_state *ctdbd_call_send(struct ctdb_db_context *ctdb_db, struct ctdb_call *call);
 int ctdbd_call_recv(struct ctdb_call_state *state, struct ctdb_call *call);
 
index 92dc8de59d0156108d9daa6a3e944de997015832..cbe6b23ce0e8ca357a1d03e06cd29f926739385f 100644 (file)
@@ -1145,7 +1145,7 @@ static void ctdb_create_pidfile(pid_t pid)
 /*
   start the protocol going as a daemon
 */
-int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog, const char *public_address_list)
+int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog)
 {
        int res, ret = -1;
        struct fd_event *fde;
@@ -1261,8 +1261,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 
        initialise_node_flags(ctdb);
 
-       if (public_address_list) {
-               ctdb->public_addresses_file = public_address_list;
+       if (ctdb->public_addresses_file) {
                ret = ctdb_set_public_addresses(ctdb, true);
                if (ret == -1) {
                        DEBUG(DEBUG_ALERT,("Unable to setup public address list\n"));
index f19b48ff2ed06c7719940f5a3063140be43de19f..f3cb9d3e95fd38180178a97fb2dcbcd1754adef8 100644 (file)
@@ -53,6 +53,7 @@ static struct {
        int         max_persistent_check_errors;
 } options = {
        .nlist = NULL,
+       .public_address_list = NULL,
        .transport = "tcp",
        .event_script_dir = NULL,
        .logfile = LOGDIR "/log.ctdb",
@@ -322,6 +323,7 @@ int main(int argc, const char *argv[])
                ctdb->do_setsched = 1;
        }
 
+       ctdb->public_addresses_file = options.public_address_list;
        ctdb->do_checkpublicip = !options.no_publicipcheck;
 
        if (options.max_persistent_check_errors < 0) {
@@ -331,5 +333,5 @@ int main(int argc, const char *argv[])
        }
 
        /* start the protocol running (as a child) */
-       return ctdb_start_daemon(ctdb, interactive?false:true, options.use_syslog, options.public_address_list);
+       return ctdb_start_daemon(ctdb, interactive?false:true, options.use_syslog);
 }