The branch, master has been updated
       via  8fdda6f ctdb-scripts: Drop creation of database directories
       via  5b7bb60 ctdb-ipalloc: ctdb_takeover_run_core() takes ipalloc_state
       via  5fba874 ctdb-ipalloc: Tidy up create_merged_ip_list()
       via  837483c ctdb-ipalloc: Move IP list creation out to 
ctdb_takeover_run()
       via  cc1637b ctdb-ipalloc: Add no_ip_failback to ipalloc_state
       via  47ddd62 ctdb-ipalloc: New enum ipalloc_algorithm in ipalloc_state
       via  cfa0ffe ctdb-ipalloc: Move IP allocation state into its own struct
       via  d7739d8 ctdb-ipalloc: node_ip_coverage() doesn't need CTDB context
      from  d451bba selftest: add test for force user and well-known primary 
group

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8fdda6fa96df35e02ac8ed1f7add46efc528683e
Author: Martin Schwenke <[email protected]>
Date:   Thu Nov 19 08:35:17 2015 +1100

    ctdb-scripts: Drop creation of database directories
    
    These should be created elsewhere.  If not then something is wrong, so
    don't hide the problem.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>
    
    Autobuild-User(master): Amitay Isaacs <[email protected]>
    Autobuild-Date(master): Fri Nov 20 04:40:26 CET 2015 on sn-devel-104

commit 5b7bb6056b366a2bd834dfb09d2a37009ae38c29
Author: Martin Schwenke <[email protected]>
Date:   Thu Oct 29 21:08:07 2015 +1100

    ctdb-ipalloc: ctdb_takeover_run_core() takes ipalloc_state
    
    As do the functions called below it.  They no longer need a CTDB
    context.
    
    create_merged_ip_list() now takes both a CTDB context and an
    ipalloc_state.
    
    Drop ipalloc_state from CTDB context.  So the substitution in the
    code is:
    
      ctdb->ipalloc_state  ->  ipalloc_state
    
    Tweak the test code to match.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit 5fba874a2edd3b892f3a3c5670971b9bbe8afa81
Author: Martin Schwenke <[email protected]>
Date:   Thu Oct 29 20:46:54 2015 +1100

    ctdb-ipalloc: Tidy up create_merged_ip_list()
    
    Simplify with TALLOC_FREE() and fix some whitespace.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit 837483c8d3f8c44f9709074932a9dd7ebfac90ce
Author: Martin Schwenke <[email protected]>
Date:   Wed Oct 28 21:17:47 2015 +1100

    ctdb-ipalloc: Move IP list creation out to ctdb_takeover_run()
    
    For various reasons create_merged_ip_list() needs a CTDB context.
    This is difficult to resolve now for a few reasons, including:
    
    * The ip_tree needs somewhere to live.
    
      It isn't very useful in its current form.  However, in the future
      real remote IP monitoring will probably be added back, so leave it
      around.
    
    * It uses node flags from the ctdb_node structure.
    
      This could be changed by putting a node map into ipalloc_state
      and referencing that.
    
    For now, it is easier to move it out to where there will be a CTDB
    context available for the forseeable future.  ctdb_takeover_run() will
    need one as long as the current client interface is used.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit cc1637b17c9ae89bcc00d95f9cdfd00f67c88bc3
Author: Martin Schwenke <[email protected]>
Date:   Thu Oct 29 19:53:25 2015 +1100

    ctdb-ipalloc: Add no_ip_failback to ipalloc_state
    
    The IP allocation algorithms need the value of this tunable, so copy
    it to avoid needing the CTDB context.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit 47ddd623581477bf0a40bd8330dfaf4d8f551752
Author: Martin Schwenke <[email protected]>
Date:   Thu Oct 29 19:41:10 2015 +1100

    ctdb-ipalloc: New enum ipalloc_algorithm in ipalloc_state
    
    Algorithm-related tunables from the CTDB context no longer need to be
    accessed in the allocation logic.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit cfa0ffe78073f9e3a014bb127fb9a4b7ad95fceb
Author: Martin Schwenke <[email protected]>
Date:   Thu Oct 29 16:49:44 2015 +1100

    ctdb-ipalloc: Move IP allocation state into its own struct
    
    Most of the IP allocation code does not need a CTDB context.  However,
    temporarily hang this off the CTDB context and make only the changes
    relating to known/available IP address.  This makes those logic
    changes obvious without burying them in function type changes.
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

commit d7739d8a7f2d72c5cf6d77272d11f5dd859b6010
Author: Martin Schwenke <[email protected]>
Date:   Wed Oct 28 22:59:18 2015 +1100

    ctdb-ipalloc: node_ip_coverage() doesn't need CTDB context
    
    Signed-off-by: Martin Schwenke <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/config/events.d/00.ctdb         |   4 +-
 ctdb/include/ctdb_private.h          |   6 -
 ctdb/server/ctdb_takeover.c          | 260 ++++++++++++++++++++++-------------
 ctdb/tests/src/ctdb_takeover_tests.c |  39 ++++--
 4 files changed, 195 insertions(+), 114 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb
index 99a0c71..3bc20d7 100755
--- a/ctdb/config/events.d/00.ctdb
+++ b/ctdb/config/events.d/00.ctdb
@@ -65,7 +65,7 @@ check_tdb ()
 check_persistent_databases ()
 {
     _dir="${CTDB_DBDIR_PERSISTENT:-${CTDB_DBDIR:-${CTDB_VARDIR}}/persistent}"
-    mkdir -p "$_dir" 2>/dev/null
+    [ -d "$_dir" ] || return 0
 
     [ "${CTDB_MAX_PERSISTENT_CHECK_ERRORS:-0}" = "0" ] || return 0
 
@@ -80,7 +80,7 @@ check_persistent_databases ()
 check_non_persistent_databases ()
 {
     _dir="${CTDB_DBDIR:-${CTDB_VARDIR}}"
-    mkdir -p "$_dir" 2>/dev/null
+    [ -d "$_dir" ] || return 0
 
     for _db in $(ls "${_dir}/"*.tdb.*[0-9] 2>/dev/null) ; do
        check_tdb $_db || {
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 57a13d9..b7c3e5d 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -126,12 +126,6 @@ struct ctdb_node {
           if the node becomes disconnected */
        struct daemon_control_state *pending_controls;
 
-       /* used by the recovery daemon when distributing ip addresses 
-          across the nodes.  it needs to know which public ip's can be handled
-          by each node.
-       */
-       struct ctdb_public_ip_list_old *known_public_ips;
-       struct ctdb_public_ip_list_old *available_public_ips;
        /* used by the recovery dameon to track when a node should be banned */
        struct ctdb_banning_state *ban_state; 
 };
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index c9179d3..d99f9aa 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -53,6 +53,23 @@ struct ctdb_ipflags {
        bool noiphost;
 };
 
+enum ipalloc_algorithm {
+       IPALLOC_DETERMINISTIC,
+       IPALLOC_NONDETERMINISTIC,
+       IPALLOC_LCP2,
+};
+
+struct ipalloc_state {
+       uint32_t num;
+
+       /* Arrays with data for each node */
+       struct ctdb_public_ip_list_old **known_public_ips;
+       struct ctdb_public_ip_list_old **available_public_ips;
+
+       enum ipalloc_algorithm algorithm;
+       uint32_t no_ip_failback;
+};
+
 struct ctdb_interface {
        struct ctdb_interface *prev, *next;
        const char *name;
@@ -1242,8 +1259,7 @@ struct public_ip_list {
 /* Given a physical node, return the number of
    public addresses that is currently assigned to this node.
 */
-static int node_ip_coverage(struct ctdb_context *ctdb, int32_t pnn,
-                           struct public_ip_list *ips)
+static int node_ip_coverage(int32_t pnn, struct public_ip_list *ips)
 {
        int num=0;
 
@@ -1259,7 +1275,8 @@ static int node_ip_coverage(struct ctdb_context *ctdb, 
int32_t pnn,
 /* Can the given node host the given IP: is the public IP known to the
  * node and is NOIPHOST unset?
 */
-static bool can_node_host_ip(struct ctdb_context *ctdb, int32_t pnn,
+static bool can_node_host_ip(struct ipalloc_state *ipalloc_state,
+                            int32_t pnn,
                             struct ctdb_ipflags ipflags,
                             struct public_ip_list *ip)
 {
@@ -1270,7 +1287,7 @@ static bool can_node_host_ip(struct ctdb_context *ctdb, 
int32_t pnn,
                return false;
        }
 
-       public_ips = ctdb->nodes[pnn]->available_public_ips;
+       public_ips = ipalloc_state->available_public_ips[pnn];
 
        if (public_ips == NULL) {
                return false;
@@ -1286,7 +1303,8 @@ static bool can_node_host_ip(struct ctdb_context *ctdb, 
int32_t pnn,
        return false;
 }
 
-static bool can_node_takeover_ip(struct ctdb_context *ctdb, int32_t pnn,
+static bool can_node_takeover_ip(struct ipalloc_state *ipalloc_state,
+                                int32_t pnn,
                                 struct ctdb_ipflags ipflags,
                                 struct public_ip_list *ip)
 {
@@ -1294,14 +1312,14 @@ static bool can_node_takeover_ip(struct ctdb_context 
*ctdb, int32_t pnn,
                return false;
        }
 
-       return can_node_host_ip(ctdb, pnn, ipflags, ip);
+       return can_node_host_ip(ipalloc_state, pnn, ipflags, ip);
 }
 
 /* search the node lists list for a node to takeover this ip.
    pick the node that currently are serving the least number of ips
    so that the ips get spread out evenly.
 */
-static int find_takeover_node(struct ctdb_context *ctdb,
+static int find_takeover_node(struct ipalloc_state *ipalloc_state,
                              struct ctdb_ipflags *ipflags,
                              struct public_ip_list *ip,
                              struct public_ip_list *all_ips)
@@ -1313,12 +1331,12 @@ static int find_takeover_node(struct ctdb_context *ctdb,
        pnn    = -1;
        for (i=0; i<numnodes; i++) {
                /* verify that this node can serve this ip */
-               if (!can_node_takeover_ip(ctdb, i, ipflags[i], ip)) {
+               if (!can_node_takeover_ip(ipalloc_state, i, ipflags[i], ip)) {
                        /* no it couldnt   so skip to the next node */
                        continue;
                }
 
-               num = node_ip_coverage(ctdb, i, all_ips);
+               num = node_ip_coverage(i, all_ips);
                /* was this the first node we checked ? */
                if (pnn == -1) {
                        pnn = i;
@@ -1329,7 +1347,7 @@ static int find_takeover_node(struct ctdb_context *ctdb,
                                min  = num;
                        }
                }
-       }       
+       }
        if (pnn == -1) {
                DEBUG(DEBUG_WARNING,(__location__ " Could not find node to take 
over public address '%s'\n",
                        ctdb_addr_to_str(&ip->addr)));
@@ -1398,25 +1416,21 @@ static int verify_remote_ip_allocation(struct 
ctdb_context *ctdb,
                                       uint32_t pnn);
 
 static int ctdb_reload_remote_public_ips(struct ctdb_context *ctdb,
+                                        struct ipalloc_state *ipalloc_state,
                                         struct ctdb_node_map_old *nodemap)
 {
        int j;
        int ret;
 
-       if (ctdb->num_nodes != nodemap->num) {
-               DEBUG(DEBUG_ERR, (__location__ " ctdb->num_nodes (%d) != 
nodemap->num (%d) invalid param\n",
-                                 ctdb->num_nodes, nodemap->num));
+       if (ipalloc_state->num != nodemap->num) {
+               DEBUG(DEBUG_ERR,
+                     (__location__
+                      " ipalloc_state->num (%d) != nodemap->num (%d) invalid 
param\n",
+                      ipalloc_state->num, nodemap->num));
                return -1;
        }
 
        for (j=0; j<nodemap->num; j++) {
-               /* For readability */
-               struct ctdb_node *node = ctdb->nodes[j];
-
-               /* release any existing data */
-               TALLOC_FREE(node->known_public_ips);
-               TALLOC_FREE(node->available_public_ips);
-
                if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
                        continue;
                }
@@ -1424,34 +1438,34 @@ static int ctdb_reload_remote_public_ips(struct 
ctdb_context *ctdb,
                /* Retrieve the list of known public IPs from the node */
                ret = ctdb_ctrl_get_public_ips_flags(ctdb,
                                        TAKEOVER_TIMEOUT(),
-                                       node->pnn,
+                                       j,
                                        ctdb->nodes,
                                        0,
-                                       &node->known_public_ips);
+                                       &ipalloc_state->known_public_ips[j]);
                if (ret != 0) {
                        DEBUG(DEBUG_ERR,
                              ("Failed to read known public IPs from node: 
%u\n",
-                              node->pnn));
+                              j));
                        return -1;
                }
 
                if (ctdb->do_checkpublicip) {
                        verify_remote_ip_allocation(ctdb,
-                                                   node->known_public_ips,
-                                                   node->pnn);
+                                                   
ipalloc_state->known_public_ips[j],
+                                                   j);
                }
 
                /* Retrieve the list of available public IPs from the node */
                ret = ctdb_ctrl_get_public_ips_flags(ctdb,
                                        TAKEOVER_TIMEOUT(),
-                                       node->pnn,
+                                       j,
                                        ctdb->nodes,
                                        CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE,
-                                       &node->available_public_ips);
+                                       
&ipalloc_state->available_public_ips[j]);
                if (ret != 0) {
                        DEBUG(DEBUG_ERR,
                              ("Failed to read available public IPs from node: 
%u\n",
-                              node->pnn));
+                              j));
                        return -1;
                }
        }
@@ -1460,20 +1474,17 @@ static int ctdb_reload_remote_public_ips(struct 
ctdb_context *ctdb,
 }
 
 static struct public_ip_list *
-create_merged_ip_list(struct ctdb_context *ctdb)
+create_merged_ip_list(struct ctdb_context *ctdb, struct ipalloc_state 
*ipalloc_state)
 {
        int i, j;
        struct public_ip_list *ip_list;
        struct ctdb_public_ip_list_old *public_ips;
 
-       if (ctdb->ip_tree != NULL) {
-               talloc_free(ctdb->ip_tree);
-               ctdb->ip_tree = NULL;
-       }
+       TALLOC_FREE(ctdb->ip_tree);
        ctdb->ip_tree = trbt_create(ctdb, 0);
 
-       for (i=0;i<ctdb->num_nodes;i++) {
-               public_ips = ctdb->nodes[i]->known_public_ips;
+       for (i=0; i < ctdb->num_nodes; i++) {
+               public_ips = ipalloc_state->known_public_ips[i];
 
                if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
                        continue;
@@ -1482,9 +1493,9 @@ create_merged_ip_list(struct ctdb_context *ctdb)
                /* there were no public ips for this node */
                if (public_ips == NULL) {
                        continue;
-               }               
+               }
 
-               for (j=0;j<public_ips->num;j++) {
+               for (j=0; j < public_ips->num; j++) {
                        struct public_ip_list *tmp_ip;
 
                        tmp_ip = talloc_zero(ctdb->ip_tree, struct 
public_ip_list);
@@ -1614,20 +1625,22 @@ static uint32_t lcp2_imbalance(struct public_ip_list * 
all_ips, int pnn)
 /* Allocate any unassigned IPs just by looping through the IPs and
  * finding the best node for each.
  */
-static void basic_allocate_unassigned(struct ctdb_context *ctdb,
+static void basic_allocate_unassigned(struct ipalloc_state *ipalloc_state,
                                      struct ctdb_ipflags *ipflags,
                                      struct public_ip_list *all_ips)
 {
        struct public_ip_list *tmp_ip;
 
-       /* loop over all ip's and find a physical node to cover for 
+       /* loop over all ip's and find a physical node to cover for
           each unassigned ip.
        */
        for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
                if (tmp_ip->pnn == -1) {
-                       if (find_takeover_node(ctdb, ipflags, tmp_ip, all_ips)) 
{
-                               DEBUG(DEBUG_WARNING,("Failed to find node to 
cover ip %s\n",
-                                       ctdb_addr_to_str(&tmp_ip->addr)));
+                       if (find_takeover_node(ipalloc_state, ipflags,
+                                              tmp_ip, all_ips)) {
+                               DEBUG(DEBUG_WARNING,
+                                     ("Failed to find node to cover ip %s\n",
+                                      ctdb_addr_to_str(&tmp_ip->addr)));
                        }
                }
        }
@@ -1635,7 +1648,7 @@ static void basic_allocate_unassigned(struct ctdb_context 
*ctdb,
 
 /* Basic non-deterministic rebalancing algorithm.
  */
-static void basic_failback(struct ctdb_context *ctdb,
+static void basic_failback(struct ipalloc_state *ipalloc_state,
                           struct ctdb_ipflags *ipflags,
                           struct public_ip_list *all_ips,
                           int num_ips)
@@ -1668,12 +1681,13 @@ try_again:
                minnode = -1;
                for (i=0; i<numnodes; i++) {
                        /* only check nodes that can actually serve this ip */
-                       if (!can_node_takeover_ip(ctdb, i, ipflags[i], tmp_ip)) 
{
+                       if (!can_node_takeover_ip(ipalloc_state, i,
+                                                 ipflags[i], tmp_ip)) {
                                /* no it couldnt   so skip to the next node */
                                continue;
                        }
 
-                       num = node_ip_coverage(ctdb, i, all_ips);
+                       num = node_ip_coverage(i, all_ips);
                        if (maxnode == -1) {
                                maxnode = i;
                                maxnum  = num;
@@ -1713,7 +1727,10 @@ try_again:
                        /* Reassign one of maxnode's VNNs */
                        for (tmp=all_ips;tmp;tmp=tmp->next) {
                                if (tmp->pnn == maxnode) {
-                                       (void)find_takeover_node(ctdb, ipflags, 
tmp, all_ips);
+                                       (void)find_takeover_node(ipalloc_state,
+                                                                ipflags,
+                                                                tmp,
+                                                                all_ips);
                                        retries++;
                                        goto try_again;;
                                }
@@ -1722,7 +1739,7 @@ try_again:
        }
 }
 
-static void lcp2_init(struct ctdb_context *tmp_ctx,
+static void lcp2_init(TALLOC_CTX *tmp_ctx,
                      struct ctdb_ipflags *ipflags,
                      struct public_ip_list *all_ips,
                      uint32_t *force_rebalance_nodes,
@@ -1780,7 +1797,7 @@ static void lcp2_init(struct ctdb_context *tmp_ctx,
 /* Allocate any unassigned addresses using the LCP2 algorithm to find
  * the IP/node combination that will cost the least.
  */
-static void lcp2_allocate_unassigned(struct ctdb_context *ctdb,
+static void lcp2_allocate_unassigned(struct ipalloc_state *ipalloc_state,
                                     struct ctdb_ipflags *ipflags,
                                     struct public_ip_list *all_ips,
                                     uint32_t *lcp2_imbalances)
@@ -1815,7 +1832,8 @@ static void lcp2_allocate_unassigned(struct ctdb_context 
*ctdb,
 
                        for (dstnode=0; dstnode<numnodes; dstnode++) {
                                /* only check nodes that can actually takeover 
this ip */
-                               if (!can_node_takeover_ip(ctdb, dstnode,
+                               if (!can_node_takeover_ip(ipalloc_state,
+                                                         dstnode,
                                                          ipflags[dstnode],
                                                          tmp_ip)) {
                                        /* no it couldnt   so skip to the next 
node */
@@ -1878,7 +1896,7 @@ static void lcp2_allocate_unassigned(struct ctdb_context 
*ctdb,
  * to move IPs from, determines the best IP/destination node
  * combination to move from the source node.
  */
-static bool lcp2_failback_candidate(struct ctdb_context *ctdb,
+static bool lcp2_failback_candidate(struct ipalloc_state *ipalloc_state,
                                    struct ctdb_ipflags *ipflags,
                                    struct public_ip_list *all_ips,
                                    int srcnode,
@@ -1926,7 +1944,7 @@ static bool lcp2_failback_candidate(struct ctdb_context 
*ctdb,
                        }
 
                        /* only check nodes that can actually takeover this ip 
*/
-                       if (!can_node_takeover_ip(ctdb, dstnode,
+                       if (!can_node_takeover_ip(ipalloc_state, dstnode,
                                                  ipflags[dstnode], tmp_ip)) {
                                /* no it couldnt   so skip to the next node */
                                continue;
@@ -1995,7 +2013,7 @@ static int lcp2_cmp_imbalance_pnn(const void * a, const 
void * b)
  * node with the highest LCP2 imbalance, and then determines the best
  * IP/destination node combination to move from the source node.
  */
-static void lcp2_failback(struct ctdb_context *ctdb,
+static void lcp2_failback(struct ipalloc_state *ipalloc_state,
                          struct ctdb_ipflags *ipflags,
                          struct public_ip_list *all_ips,
                          uint32_t *lcp2_imbalances,
@@ -2014,7 +2032,7 @@ try_again:
         */
        DEBUG(DEBUG_DEBUG,("+++++++++++++++++++++++++++++++++++++++++\n"));
        DEBUG(DEBUG_DEBUG,("Selecting most imbalanced node from:\n"));
-       lips = talloc_array(ctdb, struct lcp2_imbalance_pnn, numnodes);
+       lips = talloc_array(ipalloc_state, struct lcp2_imbalance_pnn, numnodes);
        for (i=0; i<numnodes; i++) {
                lips[i].imbalance = lcp2_imbalances[i];
                lips[i].pnn = i;
@@ -2032,7 +2050,7 @@ try_again:
                        break;
                }
 
-               if (lcp2_failback_candidate(ctdb,
+               if (lcp2_failback_candidate(ipalloc_state,
                                            ipflags,
                                            all_ips,
                                            lips[i].pnn,
@@ -2049,7 +2067,7 @@ try_again:
        }
 }
 
-static void unassign_unsuitable_ips(struct ctdb_context *ctdb,
+static void unassign_unsuitable_ips(struct ipalloc_state *ipalloc_state,
                                    struct ctdb_ipflags *ipflags,
                                    struct public_ip_list *all_ips)
 {
@@ -2062,7 +2080,7 @@ static void unassign_unsuitable_ips(struct ctdb_context 
*ctdb,
                if (tmp_ip->pnn == -1) {
                        continue;
                }
-               if (!can_node_host_ip(ctdb, tmp_ip->pnn,
+               if (!can_node_host_ip(ipalloc_state, tmp_ip->pnn,
                                      ipflags[tmp_ip->pnn], tmp_ip) != 0) {
                        /* this node can not serve this ip. */
                        DEBUG(DEBUG_DEBUG,("Unassign IP: %s from %d\n",
@@ -2073,7 +2091,7 @@ static void unassign_unsuitable_ips(struct ctdb_context 
*ctdb,
        }
 }
 
-static void ip_alloc_deterministic_ips(struct ctdb_context *ctdb,
+static void ip_alloc_deterministic_ips(struct ipalloc_state *ipalloc_state,
                                       struct ctdb_ipflags *ipflags,
                                       struct public_ip_list *all_ips)
 {
@@ -2096,18 +2114,18 @@ static void ip_alloc_deterministic_ips(struct 
ctdb_context *ctdb,
         * IPs, since the modulo step above implicitly fails
         * back IPs to their "home" node.
         */
-       if (1 == ctdb->tunable.no_ip_failback) {
+       if (1 == ipalloc_state->no_ip_failback) {
                DEBUG(DEBUG_WARNING, ("WARNING: 'NoIPFailback' set but ignored 
- incompatible with 'DeterministicIPs\n"));
        }
 
-       unassign_unsuitable_ips(ctdb, ipflags, all_ips);
+       unassign_unsuitable_ips(ipalloc_state, ipflags, all_ips);
 
-       basic_allocate_unassigned(ctdb, ipflags, all_ips);
+       basic_allocate_unassigned(ipalloc_state, ipflags, all_ips);
 
        /* No failback here! */
 }
 
-static void ip_alloc_nondeterministic_ips(struct ctdb_context *ctdb,
+static void ip_alloc_nondeterministic_ips(struct ipalloc_state *ipalloc_state,
                                          struct ctdb_ipflags *ipflags,
                                          struct public_ip_list *all_ips)
 {
@@ -2118,22 +2136,22 @@ static void ip_alloc_nondeterministic_ips(struct 
ctdb_context *ctdb,
                num_ips++;
        }
 
-       unassign_unsuitable_ips(ctdb, ipflags, all_ips);
+       unassign_unsuitable_ips(ipalloc_state, ipflags, all_ips);
 
-       basic_allocate_unassigned(ctdb, ipflags, all_ips);
+       basic_allocate_unassigned(ipalloc_state, ipflags, all_ips);
 
        /* If we don't want IPs to fail back then don't rebalance IPs. */
-       if (1 == ctdb->tunable.no_ip_failback) {
+       if (1 == ipalloc_state->no_ip_failback) {
                return;
        }
 
        /* Now, try to make sure the ip adresses are evenly distributed
           across the nodes.
        */
-       basic_failback(ctdb, ipflags, all_ips, num_ips);
+       basic_failback(ipalloc_state, ipflags, all_ips, num_ips);
 }
 
-static void ip_alloc_lcp2(struct ctdb_context *ctdb,
+static void ip_alloc_lcp2(struct ipalloc_state *ipalloc_state,
                          struct ctdb_ipflags *ipflags,
                          struct public_ip_list *all_ips,
                          uint32_t *force_rebalance_nodes)
@@ -2142,17 +2160,17 @@ static void ip_alloc_lcp2(struct ctdb_context *ctdb,
        bool *rebalance_candidates;
        int numnodes, num_rebalance_candidates, i;
 
-       TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+       TALLOC_CTX *tmp_ctx = talloc_new(ipalloc_state);
 
-       unassign_unsuitable_ips(ctdb, ipflags, all_ips);
+       unassign_unsuitable_ips(ipalloc_state, ipflags, all_ips);
 
        lcp2_init(tmp_ctx, ipflags, all_ips,force_rebalance_nodes,
                  &lcp2_imbalances, &rebalance_candidates);
 
-       lcp2_allocate_unassigned(ctdb, ipflags, all_ips, lcp2_imbalances);
+       lcp2_allocate_unassigned(ipalloc_state, ipflags, all_ips, 
lcp2_imbalances);
 
        /* If we don't want IPs to fail back then don't rebalance IPs. */
-       if (1 == ctdb->tunable.no_ip_failback) {
+       if (1 == ipalloc_state->no_ip_failback) {
                goto finished;
        }
 
@@ -2174,7 +2192,7 @@ static void ip_alloc_lcp2(struct ctdb_context *ctdb,
        /* Now, try to make sure the ip adresses are evenly distributed
           across the nodes.


-- 
Samba Shared Repository

Reply via email to