ctdb-takeover: Short circuit if fetching IPs from no nodes
authorMartin Schwenke <martin@meltin.net>
Fri, 27 Jan 2017 03:43:34 +0000 (14:43 +1100)
committerMartin Schwenke <martins@samba.org>
Fri, 24 Feb 2017 06:47:11 +0000 (07:47 +0100)
The current code will fetch IP from all connected and all active
nodes, so this can't happen.  However, catch it anyway in case the
calling code changes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_takeover_helper.c

index 796d45cc4a742e3760b7c0d4bd532546b3f5661f..053970510854804e5d4de4a631f1fbabf9b22c83 100644 (file)
@@ -122,6 +122,12 @@ static struct tevent_req *get_public_ips_send(
                return tevent_req_post(req, ev);
        }
 
+       /* Short circuit if no nodes being asked for IPs */
+       if (state->count == 0) {
+               tevent_req_done(req);
+               return tevent_req_post(req, ev);
+       }
+
        ctdb_req_control_get_public_ips(&request, available_only);
        subreq = ctdb_client_control_multi_send(mem_ctx, ev, client,
                                                state->pnns,