ctdb-ipalloc: Make no_ip_failback a boolean
authorMartin Schwenke <martin@meltin.net>
Tue, 21 Jun 2016 06:34:44 +0000 (16:34 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 4 Jul 2016 13:42:25 +0000 (15:42 +0200)
No need to expose tunable values that far down.

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

index efa466a..fe94c09 100644 (file)
@@ -1428,7 +1428,7 @@ static struct ipalloc_state * ipalloc_state_init(struct ctdb_context *ctdb,
                ipalloc_state->algorithm = IPALLOC_NONDETERMINISTIC;
        }
 
-       ipalloc_state->no_ip_failback = ctdb->tunable.no_ip_failback;
+       ipalloc_state->no_ip_failback = (ctdb->tunable.no_ip_failback != 0);
 
        return ipalloc_state;
 fail:
index 3d7d783..990fca4 100644 (file)
@@ -51,7 +51,7 @@ struct ipalloc_state {
 
        struct public_ip_list *all_ips;
        enum ipalloc_algorithm algorithm;
-       uint32_t no_ip_failback;
+       bool no_ip_failback;
        uint32_t *force_rebalance_nodes;
 };
 
index 2801bf6..c11d5f9 100644 (file)
@@ -48,7 +48,7 @@ bool ipalloc_deterministic(struct ipalloc_state *ipalloc_state)
         * IPs, since the modulo step above implicitly fails
         * back IPs to their "home" node.
         */
-       if (1 == ipalloc_state->no_ip_failback) {
+       if (ipalloc_state->no_ip_failback) {
                DEBUG(DEBUG_WARNING, ("WARNING: 'NoIPFailback' set but ignored - incompatible with 'DeterministicIPs\n"));
        }
 
index a4b3bdb..48e0d02 100644 (file)
@@ -487,7 +487,7 @@ bool ipalloc_lcp2(struct ipalloc_state *ipalloc_state)
        lcp2_allocate_unassigned(ipalloc_state, lcp2_imbalances);
 
        /* If we don't want IPs to fail back then don't rebalance IPs. */
-       if (1 == ipalloc_state->no_ip_failback) {
+       if (ipalloc_state->no_ip_failback) {
                goto finished;
        }
 
index 300d8f1..9951aaa 100644 (file)
@@ -134,7 +134,7 @@ bool ipalloc_nondeterministic(struct ipalloc_state *ipalloc_state)
        basic_allocate_unassigned(ipalloc_state);
 
        /* If we don't want IPs to fail back then don't rebalance IPs. */
-       if (1 == ipalloc_state->no_ip_failback) {
+       if (ipalloc_state->no_ip_failback) {
                return true;
        }