The recent change to the recovery daemon to keep track of and
[sahlberg/ctdb.git] / server / ctdb_takeover.c
index 13e0039285f5afa42856b1abf8c9f1d331f2162f..b18c030092147219dfe66f0f3c4177009c521a86 100644 (file)
@@ -2849,3 +2849,24 @@ int verify_remote_ip_allocation(struct ctdb_context *ctdb, struct ctdb_all_publi
 
        return 0;
 }
+
+int update_ip_assignment_tree(struct ctdb_context *ctdb, struct ctdb_public_ip *ip)
+{
+       struct ctdb_public_ip_list *tmp_ip; 
+
+       if (ctdb->ip_tree == NULL) {
+               DEBUG(DEBUG_ERR,("No ctdb->ip_tree yet. Failed to update ip assignment\n"));
+               return -1;
+       }
+
+       tmp_ip = trbt_lookuparray32(ctdb->ip_tree, IP_KEYLEN, ip_key(&ip->addr));
+       if (tmp_ip == NULL) {
+               DEBUG(DEBUG_ERR,(__location__ " Could not find record for address %s, update ip\n", ctdb_addr_to_str(&ip->addr)));
+               return -1;
+       }
+
+       DEBUG(DEBUG_NOTICE,("Updated ip assignment tree for ip : %s from node %u to node %u\n", ctdb_addr_to_str(&ip->addr), tmp_ip->pnn, ip->pnn));
+       tmp_ip->pnn = ip->pnn;
+
+       return 0;
+}