1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-01 05:47:28 +03:00

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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2018-08-21 09:36:00 +10:00 committed by Amitay Isaacs
parent 21de59ab7f
commit 914e9f22d8
3 changed files with 14 additions and 4 deletions

View 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");
}

View 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.
*/

View File

@ -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