From: Martin Schwenke Date: Mon, 20 Aug 2018 23:36:00 +0000 (+1000) Subject: ctdb-daemon: Pass DisableIPFailover tunable via environment variable X-Git-Tag: tdb-1.3.17~2023 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=914e9f22d85b9274871b7c7d5486354928080e51;p=thirdparty%2Fsamba.git ctdb-daemon: Pass DisableIPFailover tunable via environment variable Preparation for obsoleting this tunable. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index a081adaf6f4..6d72316e4de 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -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"); } diff --git a/ctdb/server/ctdb_takeover_helper.c b/ctdb/server/ctdb_takeover_helper.c index 9672a2b20f9..9aa77d14f1d 100644 --- a/ctdb/server/ctdb_takeover_helper.c +++ b/ctdb/server/ctdb_takeover_helper.c @@ -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. */ diff --git a/ctdb/tests/takeover_helper/016.sh b/ctdb/tests/takeover_helper/016.sh index 4d2e4fea209..7fbed7eb3b3 100755 --- a/ctdb/tests/takeover_helper/016.sh +++ b/ctdb/tests/takeover_helper/016.sh @@ -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 <