Skip to content

Commit 30beae7

Browse files
committed
clusterer_controller: netns T25, maintenance of another node at the full level
From one member, another is put into full by node_id: every node lists it as full, it logs the request it applied, the other nodes disable it in their clusterer and nobody names it master or backup. Back to none: listed as none everywhere and enabled again. A node_id outside the cluster is refused.
1 parent e88b2d9 commit 30beae7

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎modules/clusterer_controller/test/netns_tests.sh‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,37 @@ sleep 16
532532
MS=""; for i in 1 2 3 4; do MS="$MS $(members $i 741 | tr ' ' '\n' | grep ':master:' | cut -d: -f1)"; done
533533
check "healed: one master, named by all; the old master holds no released state" $([ "$(echo $MS | tr ' ' '\n' | sort -u | wc -l)" = 1 ] && [ "$(echo $MS | wc -w)" = 4 ] && [ "$(cfgval $MN 741 tag_released)" = 0 ] && echo 1 || echo 0) "$MS released=$(cfgval $MN 741 tag_released)"
534534

535+
echo "=== T25 maintenance of another node, and the full level ==="
536+
# cl_state <node> <node_id> -> enabled|disabled: that node as <node>'s clusterer has it
537+
cl_state() { mi $1 clusterer:list | python3 -c '
538+
import json,sys
539+
try: d=json.load(sys.stdin).get("result",{})
540+
except Exception: sys.exit()
541+
for c in d.get("Clusters",[]):
542+
if c.get("cluster_id")==741:
543+
for n in c.get("Nodes",[]):
544+
if n.get("node_id")==int(sys.argv[1]): print(n.get("state"))' $2; }
545+
MIP=$(members 2 741 | tr ' ' '\n' | grep ':master:' | cut -d: -f1); MN=${MIP##*.}; MN=${MN#1}
546+
for x in 1 2 3 4; do [ $x != $MN ] && break; done
547+
for y in 1 2 3 4; do [ $y != $MN ] && [ $y != $x ] && break; done
548+
XID=$(nid $y $x); XIP=$(ip4 $x)
549+
echo " from n$y: n$x ($XIP, node_id $XID) into full; master $MIP"
550+
for i in 1 2 3 4; do eval F$i=$(wc -l < $R/n$i.log); done
551+
mi $y clusterer_controller:maintenance cluster_id=741 state=full node_id=${XID:-0} >/dev/null; sleep 4
552+
V=""; for i in 1 2 3 4; do V="$V $(maint $i $XIP)"; done
553+
check "every node lists n$x as full, asked from n$y" $([ "$(echo $V | tr ' ' '\n' | sort -u)" = full ] && echo 1 || echo 0) "$V"
554+
check "n$x applied it to itself on n$y's request" $(eval m=\$F$x; since $x $m | grep -aq "asks this node into maintenance state full" && echo 1 || echo 0) ""
555+
D=""; for i in 1 2 3 4; do [ $i = $x ] && continue; D="$D $(cl_state $i $XID)"; done
556+
check "the other nodes disabled n$x in their clusterer" $([ "$(echo $D | tr ' ' '\n' | sort -u)" = disabled ] && echo 1 || echo 0) "$D"
557+
RO=""; for i in 1 2 3 4; do RO="$RO $(role_of $i $XIP)"; done
558+
check "nobody names n$x master or backup" $(echo "$RO" | grep -q 'master\|backup' && echo 0 || echo 1) "$RO"
559+
mi $y clusterer_controller:maintenance cluster_id=741 state=none node_id=${XID:-0} >/dev/null; sleep 4
560+
V=""; for i in 1 2 3 4; do V="$V $(maint $i $XIP)"; done
561+
check "back in service on every node" $([ "$(echo $V | tr ' ' '\n' | sort -u)" = none ] && echo 1 || echo 0) "$V"
562+
D=""; for i in 1 2 3 4; do [ $i = $x ] && continue; D="$D $(cl_state $i $XID)"; done
563+
check "the other nodes enabled n$x again" $([ "$(echo $D | tr ' ' '\n' | sort -u)" = enabled ] && echo 1 || echo 0) "$D"
564+
check "a node_id outside the cluster is refused" $(mi $y clusterer_controller:maintenance cluster_id=741 state=full node_id=999 | grep -q "not a member" && echo 1 || echo 0) "$(mi $y clusterer_controller:maintenance cluster_id=741 state=full node_id=999 | cut -c1-100)"
565+
535566
echo "=== replays after T12: none ==="
536567
RPN=0; for i in 1 2 3 4; do eval m=\$RP$i; RPN=$((RPN + $(since $i $m | grep -ac "already accepted, dropping\|older than the replay window, dropping"))); done
537568
check "no control packet refused as a replay since T12 (re-keys keep the sequence)" $([ $RPN = 0 ] && echo 1 || echo 0) "$RPN"

0 commit comments

Comments
 (0)