ctdb-ipalloc: Drop known public IPs from IP allocation state
authorMartin Schwenke <martin@meltin.net>
Tue, 21 Jun 2016 11:09:39 +0000 (21:09 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 4 Jul 2016 13:42:25 +0000 (15:42 +0200)
This is never used in the allocation algorithms.  It is only used when
building the merged IP list.

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

index d60da03..72e0fc4 100644 (file)
@@ -62,7 +62,8 @@ static int getips_count_callback(void *param, void *data)
  * merged list of all public addresses needs to be built so that IP
  * allocation can be done. */
 static struct public_ip_list *
-create_merged_ip_list(struct ipalloc_state *ipalloc_state)
+create_merged_ip_list(struct ipalloc_state *ipalloc_state,
+                     struct ctdb_public_ip_list *known_ips)
 {
        int i, j;
        struct public_ip_list *ip_list;
@@ -71,14 +72,14 @@ create_merged_ip_list(struct ipalloc_state *ipalloc_state)
 
        ip_tree = trbt_create(ipalloc_state, 0);
 
-       if (ipalloc_state->known_public_ips == NULL) {
+       if (known_ips == NULL) {
                DEBUG(DEBUG_ERR, ("Known public IPs not set\n"));
                return NULL;
        }
 
        for (i=0; i < ipalloc_state->num; i++) {
 
-               public_ips = &ipalloc_state->known_public_ips[i];
+               public_ips = &known_ips[i];
 
                for (j=0; j < public_ips->num; j++) {
                        struct public_ip_list *tmp_ip;
@@ -120,10 +121,10 @@ bool ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state,
                            struct ctdb_public_ip_list *known_ips,
                            struct ctdb_public_ip_list *available_ips)
 {
-       ipalloc_state->known_public_ips = known_ips;
        ipalloc_state->available_public_ips = available_ips;
 
-       ipalloc_state->all_ips = create_merged_ip_list(ipalloc_state);
+       ipalloc_state->all_ips = create_merged_ip_list(ipalloc_state,
+                                                      known_ips);
 
        return (ipalloc_state->all_ips != NULL);
 }
index b5a1bcc..06c69f8 100644 (file)
@@ -45,7 +45,6 @@ struct ipalloc_state {
        uint32_t num;
 
        /* Arrays with data for each node */
-       struct ctdb_public_ip_list *known_public_ips;
        struct ctdb_public_ip_list *available_public_ips;
        bool *noiptakeover;
        bool *noiphost;