ctdb-ipalloc: Do not use node count or PNNs from CTDB context
authorMartin Schwenke <martin@meltin.net>
Mon, 23 May 2016 04:50:14 +0000 (14:50 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 4 Jul 2016 13:42:24 +0000 (15:42 +0200)
This is unnecessary.  IP allocation state already has a node count and
"i" is already a PNN.

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

index 41beffc3016e396169f2f665c4678b10a722ae77..bb548910dd04224bdd18ffb759a31e419a31ae83 100644 (file)
@@ -1245,7 +1245,7 @@ create_merged_ip_list(struct ctdb_context *ctdb, struct ipalloc_state *ipalloc_s
                return NULL;
        }
 
-       for (i=0; i < ctdb->num_nodes; i++) {
+       for (i=0; i < ipalloc_state->num; i++) {
 
                public_ips = &ipalloc_state->known_public_ips[i];
 
@@ -1256,7 +1256,7 @@ create_merged_ip_list(struct ctdb_context *ctdb, struct ipalloc_state *ipalloc_s
                        CTDB_NO_MEMORY_NULL(ctdb, tmp_ip);
                        /* Do not use information about IP addresses hosted
                         * on other nodes, it may not be accurate */
-                       if (public_ips->ip[j].pnn == ctdb->nodes[i]->pnn) {
+                       if (public_ips->ip[j].pnn == i) {
                                tmp_ip->pnn = public_ips->ip[j].pnn;
                        } else {
                                tmp_ip->pnn = -1;