recoverd/takeover: Use IP->node mapping info from nodes hosting that IP
authorAmitay Isaacs <amitay@gmail.com>
Fri, 5 Apr 2013 02:34:06 +0000 (13:34 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 8 Apr 2013 01:16:55 +0000 (11:16 +1000)
When collating IP information for IP layout, only trust the nodes that are
hosting an IP, to have correct information about that IP.  Ignore what all the
other nodes think.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 1c7adbccc69ac276d2b957ad16c3802fdb8868ca)

server/ctdb_takeover.c

index 5704b094cdedfd59b7d328383c2b454201382929..481b4db15fc0b56be5840d06d2c0f42e377e0233 100644 (file)
@@ -1243,7 +1243,13 @@ create_merged_ip_list(struct ctdb_context *ctdb)
 
                        tmp_ip = talloc_zero(ctdb->ip_tree, struct ctdb_public_ip_list);
                        CTDB_NO_MEMORY_NULL(ctdb, tmp_ip);
-                       tmp_ip->pnn  = public_ips->ips[j].pnn;
+                       /* Do not use information about IP addresses hosted
+                        * on other nodes, it may not be accurate */
+                       if (public_ips->ips[j].pnn == ctdb->nodes[i]->pnn) {
+                               tmp_ip->pnn = public_ips->ips[j].pnn;
+                       } else {
+                               tmp_ip->pnn = -1;
+                       }
                        tmp_ip->addr = public_ips->ips[j].addr;
                        tmp_ip->next = NULL;