]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Pass DisableIPFailover tunable via environment variable
authorMartin Schwenke <martin@meltin.net>
Mon, 20 Aug 2018 23:36:00 +0000 (09:36 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 24 Aug 2018 08:59:21 +0000 (10:59 +0200)
Preparation for obsoleting this tunable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c
ctdb/server/ctdb_takeover_helper.c
ctdb/tests/takeover_helper/016.sh

index a081adaf6f461407f0cf7bad4c6cc6f69e137cba..6d72316e4de9829bd82f9fa0263650edaf68742e 100644 (file)
@@ -1127,7 +1127,7 @@ static int ctdb_takeover(struct ctdb_recoverd *rec,
 {
        static char prog[PATH_MAX+1] = "";
        char *arg;
-       int i;
+       int i, ret;
 
        if (!ctdb_set_helper("takeover_helper", prog, sizeof(prog),
                             "CTDB_TAKEOVER_HELPER", CTDB_HELPER_BINDIR,
@@ -1149,6 +1149,14 @@ static int ctdb_takeover(struct ctdb_recoverd *rec,
                }
        }
 
+       if (rec->ctdb->tunable.disable_ip_failover != 0) {
+               ret = setenv("CTDB_DISABLE_IP_FAILOVER", "1", 1);
+               if (ret != 0) {
+                       D_ERR("Failed to set CTDB_DISABLE_IP_FAILOVER variable\n");
+                       return -1;
+               }
+       }
+
        return helper_run(rec, rec, prog, arg, "takeover");
 }
 
index 9672a2b20f92f27169bd2f082ddeabf2001d7eeb..9aa77d14f1da8dc2bf0a2e2e3c8ea9086ee52ca0 100644 (file)
@@ -799,6 +799,7 @@ static void takeover_nodemap_done(struct tevent_req *subreq)
        bool status;
        int ret;
        struct ctdb_node_map *nodemap;
+       const char *ptr;
 
        status = ctdb_client_control_recv(subreq, &ret, state, &reply);
        TALLOC_FREE(subreq);
@@ -845,7 +846,8 @@ static void takeover_nodemap_done(struct tevent_req *subreq)
                return;
        }
 
-       if (state->tun_list->disable_ip_failover != 0) {
+       ptr = getenv("CTDB_DISABLE_IP_FAILOVER");
+       if (ptr != NULL) {
                /* IP failover is completely disabled so just send out
                 * ipreallocated event.
                 */
index 4d2e4fea20984e1b105071677b0d37cc3f8d3a29..7fbed7eb3b3079a5e9a6cbaed425b6f14ce77086 100755 (executable)
@@ -2,7 +2,7 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "3 nodes, all healthy, IPs all unassigned, DisableIPFailover"
+define_test "3 nodes, all healthy, IPs all unassigned, IP failover disabled"
 
 setup_ctdbd <<EOF
 NODEMAP
@@ -21,7 +21,7 @@ PUBLICIPS
 10.0.0.33  -1
 EOF
 
-ctdb_cmd setvar DisableIPFailover 1
+export CTDB_DISABLE_IP_FAILOVER=1
 
 ok <<EOF
 EOF