ctdb-takeover: Known and available IP lists should be the same size as nodemap
authorAmitay Isaacs <amitay@gmail.com>
Wed, 11 Jan 2017 05:49:33 +0000 (16:49 +1100)
committerMartin Schwenke <martins@samba.org>
Thu, 12 Jan 2017 18:25:23 +0000 (19:25 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12511

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

index f83b914db7d023a9dce030d6a74c3ed048223199..d96e6c8605bbc845ef4894839df5d97e1b4ec728 100644 (file)
@@ -91,7 +91,7 @@ struct get_public_ips_state {
        struct tevent_context *ev;
        struct ctdb_client_context *client;
        uint32_t *pnns;
-       int count;
+       int count, num_nodes;
        struct ctdb_public_ip_list *ips;
 };
 
@@ -102,7 +102,7 @@ static struct tevent_req *get_public_ips_send(
                                struct tevent_context *ev,
                                struct ctdb_client_context *client,
                                uint32_t *pnns,
-                               int count,
+                               int count, int num_nodes,
                                bool available_only)
 {
        struct tevent_req *req, *subreq;
@@ -116,6 +116,7 @@ static struct tevent_req *get_public_ips_send(
 
        state->pnns = pnns;
        state->count = count;
+       state->num_nodes = num_nodes;
        state->ips = NULL;
 
        ctdb_req_control_get_public_ips(&request, available_only);
@@ -164,7 +165,7 @@ static void get_public_ips_done(struct tevent_req *subreq)
        }
 
        state->ips = talloc_zero_array(state, struct ctdb_public_ip_list,
-                                      state->count);
+                                      state->num_nodes);
        if (tevent_req_nomem(state->ips, req)) {
                return;
        }
@@ -832,7 +833,7 @@ static void takeover_nodemap_done(struct tevent_req *subreq)
 
        subreq = get_public_ips_send(state, state->ev, state->client,
                                     state->pnns_active, state->num_active,
-                                    false);
+                                    state->num_nodes, false);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -860,7 +861,7 @@ static void takeover_known_ips_done(struct tevent_req *subreq)
 
        subreq = get_public_ips_send(state, state->ev, state->client,
                                     state->pnns_active, state->num_active,
-                                    true);
+                                    state->num_nodes, true);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }