forked from samba-team/samba
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ctdb: Add "home_nodes" file to deterministic IP allocation
With a file "home_nodes" next to "public_addresses" you can assign public IPs to specific nodes when using the deterministic allocation algorithm. Whenever the "home node" is up, the IP address will be assigned to that node, independent of any other deterministic calculation. The line 192.168.21.254 2 in the file "home_nodes" assigns the IP address to node 2. Only when node 2 is not able to host IP addresses, 192.168.21.254 undergoes the normal deterministic IP allocation algorithm. Signed-off-by: Volker Lendecke <[email protected]> add home_nodes Reviewed-by: Ralph Boehme <[email protected]> Autobuild-User(master): Volker Lendecke <[email protected]> Autobuild-Date(master): Tue Oct 10 14:17:19 UTC 2023 on atb-devel-224
- Loading branch information
Showing
5 changed files
with
270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
. "${TEST_SCRIPTS_DIR}/unit.sh" | ||
|
||
setup_ctdb_base "$CTDB_TEST_TMP_DIR" "ctdb-etc" | ||
|
||
define_test "3 nodes, all healthy with home_nodes" | ||
|
||
home_nodes="$CTDB_BASE"/home_nodes | ||
|
||
cat > "$home_nodes" <<EOF | ||
192.168.21.254 2 | ||
192.168.20.251 1 | ||
EOF | ||
|
||
required_result <<EOF | ||
${TEST_DATE_STAMP}Deterministic IPs enabled. Resetting all ip allocations | ||
192.168.21.254 2 | ||
192.168.21.253 1 | ||
192.168.21.252 2 | ||
192.168.20.254 0 | ||
192.168.20.253 1 | ||
192.168.20.252 2 | ||
192.168.20.251 1 | ||
192.168.20.250 1 | ||
192.168.20.249 2 | ||
EOF | ||
|
||
simple_test 0,0,0 <<EOF | ||
192.168.20.249 1 | ||
192.168.20.250 1 | ||
192.168.20.251 1 | ||
192.168.20.252 1 | ||
192.168.20.253 1 | ||
192.168.20.254 1 | ||
192.168.21.252 1 | ||
192.168.21.253 1 | ||
192.168.21.254 1 | ||
EOF | ||
|
||
rm "$home_nodes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
|
||
. "${TEST_SCRIPTS_DIR}/unit.sh" | ||
|
||
setup_ctdb_base "$CTDB_TEST_TMP_DIR" "ctdb-etc" | ||
|
||
define_test "3 nodes, 2 healthy with home_nodes" | ||
|
||
home_nodes="$CTDB_BASE"/home_nodes | ||
|
||
cat > "$home_nodes" <<EOF | ||
192.168.21.254 2 | ||
192.168.20.251 1 | ||
EOF | ||
|
||
required_result <<EOF | ||
${TEST_DATE_STAMP}Deterministic IPs enabled. Resetting all ip allocations | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.21.253 from 1 | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.20.253 from 1 | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.20.251 from 1 | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.20.250 from 1 | ||
192.168.21.254 2 | ||
192.168.21.253 0 | ||
192.168.21.252 2 | ||
192.168.20.254 0 | ||
192.168.20.253 0 | ||
192.168.20.252 2 | ||
192.168.20.251 0 | ||
192.168.20.250 0 | ||
192.168.20.249 2 | ||
EOF | ||
|
||
simple_test 0,2,0 <<EOF | ||
192.168.20.249 0 | ||
192.168.20.250 1 | ||
192.168.20.251 2 | ||
192.168.20.252 0 | ||
192.168.20.253 1 | ||
192.168.20.254 2 | ||
192.168.21.252 0 | ||
192.168.21.253 1 | ||
192.168.21.254 2 | ||
EOF | ||
|
||
rm "$home_nodes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
. "${TEST_SCRIPTS_DIR}/unit.sh" | ||
|
||
setup_ctdb_base "$CTDB_TEST_TMP_DIR" "ctdb-etc" | ||
|
||
define_test "3 nodes, 1 healthy with home_nodes" | ||
|
||
home_nodes="$CTDB_BASE"/home_nodes | ||
|
||
cat > "$home_nodes" <<EOF | ||
192.168.21.254 2 | ||
192.168.20.251 1 | ||
EOF | ||
|
||
required_result <<EOF | ||
${TEST_DATE_STAMP}Deterministic IPs enabled. Resetting all ip allocations | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.21.253 from 1 | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.20.254 from 0 | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.20.253 from 1 | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.20.251 from 1 | ||
${TEST_DATE_STAMP}Unassign IP: 192.168.20.250 from 1 | ||
192.168.21.254 2 | ||
192.168.21.253 2 | ||
192.168.21.252 2 | ||
192.168.20.254 2 | ||
192.168.20.253 2 | ||
192.168.20.252 2 | ||
192.168.20.251 2 | ||
192.168.20.250 2 | ||
192.168.20.249 2 | ||
EOF | ||
|
||
simple_test 2,2,0 <<EOF | ||
192.168.20.249 0 | ||
192.168.20.250 1 | ||
192.168.20.251 2 | ||
192.168.20.252 0 | ||
192.168.20.253 1 | ||
192.168.20.254 2 | ||
192.168.21.252 0 | ||
192.168.21.253 1 | ||
192.168.21.254 2 | ||
EOF | ||
|
||
rm "$home_nodes" |