blob: a8104eb0b3d2bef8e868d78f04b226a21bfd1997 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
setup ()
{
_ip="$1"
_iface="$2"
export FAKE_LVS_STATE_DIR="${FAKE_NETWORK_STATE}/lvs"
mkdir -p "$FAKE_LVS_STATE_DIR"
lvs_header=$(ipvsadm -l -n)
[ -n "$_ip" ] || return 0
[ -n "$_iface" ] || return 0
setup_script_options <<EOF
CTDB_LVS_NODES="${CTDB_BASE}/lvs_nodes"
CTDB_LVS_PUBLIC_IP="$_ip"
CTDB_LVS_PUBLIC_IFACE="$_iface"
EOF
export FAKE_CTDB_LVS_LEADER=""
# Read from stdin
_pnn=0
while read _ip _opts ; do
case "$_opts" in
leader)
FAKE_CTDB_LVS_LEADER="$_pnn"
echo "$_ip"
;;
follower-only)
printf "%s\tfollower-only\n" "$_ip"
;;
*)
echo "$_ip"
;;
esac
_pnn=$(($_pnn + 1))
done >"$CTDB_LVS_NODES"
}
check_ipvsadm ()
{
if [ "$1" = "NULL" ] ; then
required_result 0 <<EOF
$lvs_header
EOF
else
required_result 0 <<EOF
$lvs_header
$(cat)
EOF
fi
simple_test_command ipvsadm -l -n
}
check_lvs_ip ()
{
_scope="$1"
if [ "$_scope" = "NULL" ] ; then
required_result 0 <<EOF
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
EOF
else
required_result 0 <<EOF
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet ${CTDB_LVS_PUBLIC_IP}/32 scope ${_scope} lo
valid_lft forever preferred_lft forever
EOF
fi
simple_test_command ip addr show dev lo
}
|