ctdbd: Log a meaningful message if the nodes file/list is empty
authorMartin Schwenke <martin@meltin.net>
Tue, 3 Jul 2012 21:21:01 +0000 (07:21 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 26 Jul 2012 12:10:54 +0000 (22:10 +1000)
Right now the message says it can't bind to any of the
addresses... even when there aren't any!

Signed-off-by: Martin Schwenke <martin@meltin.net>
tcp/tcp_connect.c

index 2814201f924b968197125a9515a857c1102ba97d..c94b88f6709008591e21fd9fd52d3bbeb08e7d5e 100644 (file)
@@ -281,6 +281,15 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
        int sock_size;
        struct tevent_fd *fde;
 
+       /* If there are no nodes, then it won't be possible to find
+        * the first one.  Log a failure and short circuit the whole
+        * process.
+        */
+       if (ctdb->num_nodes == 0) {
+               DEBUG(DEBUG_CRIT,("No nodes available to attempt bind to - is the nodes file empty?\n"));
+               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