@@ -58,6 +58,10 @@ gw_name() {
58
58
docker ps --format ' {{.ID}}\t{{.Names}}' --filter status=running --filter status=exited | awk ' $2 ~ /nvmeof/ && $2 ~ /' $i ' / {print $1}'
59
59
}
60
60
61
+ gw_ip () {
62
+ docker inspect -f ' {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' " $( gw_name $1 ) "
63
+ }
64
+
61
65
# Function to access numbers by index
62
66
access_number_by_index () {
63
67
numbers=$1
@@ -109,6 +113,50 @@ choose_n_m() {
109
113
done
110
114
}
111
115
116
+ count_namespaces_in_anagrp () {
117
+ json=" $1 " # subsystems json data
118
+ subsystem_idx=" $2 " # subsystem index (e.g., 0, 1)
119
+ ana_group=" $3 " # ana group id
120
+
121
+ echo " $json " | jq " .subsystems[$subsystem_idx ].namespaces | map(select(.anagrpid == $ana_group )) | length"
122
+ }
123
+
124
+ verify_num_namespaces () {
125
+ # verify initial distribution of namespaces
126
+ for g in $( seq $NUM_GATEWAYS ) ; do
127
+ for i in $( seq 10) ; do
128
+ echo " verify_num_namespaces $i $GW_NAME $GW_IP "
129
+ GW_NAME=$( gw_name $g )
130
+ GW_IP=$( gw_ip $g )
131
+ subs=$( docker compose run --rm nvmeof-cli --server-address $GW_IP --server-port 5500 get_subsystems 2>&1 | sed ' s/Get subsystems://' )
132
+
133
+ # ensure namespaces are evenly distributed across ANA groups.
134
+ # each subsystem should have 32 namespaces divided equally among four ANA groups.
135
+ if [ " $( count_namespaces_in_anagrp " $subs " 0 1) " -ne $NUM_NAMESPACES_IN_ANA_GROUP -o \
136
+ " $( count_namespaces_in_anagrp " $subs " 0 2) " -ne $NUM_NAMESPACES_IN_ANA_GROUP -o \
137
+ " $( count_namespaces_in_anagrp " $subs " 0 3) " -ne $NUM_NAMESPACES_IN_ANA_GROUP -o \
138
+ " $( count_namespaces_in_anagrp " $subs " 0 4) " -ne $NUM_NAMESPACES_IN_ANA_GROUP -o \
139
+ " $( count_namespaces_in_anagrp " $subs " 1 1) " -ne $NUM_NAMESPACES_IN_ANA_GROUP -o \
140
+ " $( count_namespaces_in_anagrp " $subs " 1 2) " -ne $NUM_NAMESPACES_IN_ANA_GROUP -o \
141
+ " $( count_namespaces_in_anagrp " $subs " 1 3) " -ne $NUM_NAMESPACES_IN_ANA_GROUP -o \
142
+ " $( count_namespaces_in_anagrp " $subs " 1 4) " -ne $NUM_NAMESPACES_IN_ANA_GROUP ]; then
143
+
144
+ echo " Not ready $i $GW_NAME $GW_IP "
145
+ sleep 5
146
+ continue
147
+ fi
148
+ echo " ✅ verify_num_namespaces ready $i $GW_NAME $GW_IP "
149
+ break
150
+ done
151
+
152
+ # Check if the inner loop completed without breaking
153
+ if [ $i -eq 10 ]; then
154
+ echo " verify_num_namespaces ‼️ Timeout reached for $GW_NAME $GW_IP "
155
+ exit 1
156
+ fi
157
+ done
158
+ }
159
+
112
160
validate_all_active () {
113
161
for s in $( seq $NUM_SUBSYSTEMS ) ; do
114
162
all_ana_states=$( for g in $( seq $NUM_GATEWAYS ) ; do
@@ -123,6 +171,9 @@ validate_all_active() {
123
171
exit 1
124
172
fi
125
173
done
174
+
175
+ # ensure namespaces are evenly distributed across ANA groups
176
+ verify_num_namespaces
126
177
}
127
178
128
179
@@ -132,6 +183,7 @@ validate_all_active() {
132
183
133
184
NUM_SUBSYSTEMS=2
134
185
NUM_GATEWAYS=4
186
+ NUM_NAMESPACES_IN_ANA_GROUP=8
135
187
FAILING_GATEWAYS=2
136
188
NUM_OPTIMIZED_FAILOVER=2
137
189
NUM_OPTIMIZED_REBALANCE=1
0 commit comments