@@ -112,11 +112,13 @@ start_peer_and_dependent_services() {
112
112
check_warm_boot
113
113
114
114
if [[ x" $WARM_BOOT " != x" true" ]]; then
115
- if [[ ! -z $DEV ]]; then
116
- /bin/systemctl start ${PEER} @$DEV
117
- else
118
- /bin/systemctl start ${PEER}
119
- fi
115
+ for peer in ${PEER} ; do
116
+ if [[ ! -z $DEV ]]; then
117
+ /bin/systemctl start ${peer} @$DEV
118
+ else
119
+ /bin/systemctl start ${peer}
120
+ fi
121
+ done
120
122
for dep in ${DEPENDENT} ; do
121
123
/bin/systemctl start ${dep}
122
124
done
@@ -143,11 +145,13 @@ stop_peer_and_dependent_services() {
143
145
for dep in ${DEPENDENT} ; do
144
146
/bin/systemctl stop ${dep}
145
147
done
146
- if [[ ! -z $DEV ]]; then
147
- /bin/systemctl stop ${PEER} @$DEV
148
- else
149
- /bin/systemctl stop ${PEER}
150
- fi
148
+ for peer in ${PEER} ; do
149
+ if [[ ! -z $DEV ]]; then
150
+ /bin/systemctl stop ${peer} @$DEV
151
+ else
152
+ /bin/systemctl stop ${peer}
153
+ fi
154
+ done
151
155
fi
152
156
}
153
157
@@ -207,11 +211,18 @@ wait() {
207
211
# NOTE: This assumes Docker containers share the same names as their
208
212
# corresponding services
209
213
for SECS in {1..60}; do
210
- if [[ ! -z $DEV ]]; then
211
- RUNNING=$( docker inspect -f ' {{.State.Running}}' ${PEER} $DEV )
212
- else
213
- RUNNING=$( docker inspect -f ' {{.State.Running}}' ${PEER} )
214
- fi
214
+ ALL_PEERS_RUNNING=true
215
+ for peer in ${PEER} ; do
216
+ if [[ ! -z $DEV ]]; then
217
+ RUNNING=$( docker inspect -f ' {{.State.Running}}' ${peer} $DEV )
218
+ else
219
+ RUNNING=$( docker inspect -f ' {{.State.Running}}' ${peer} )
220
+ fi
221
+ if [[ x" $RUNNING " != x" true" ]]; then
222
+ ALL_PEERS_RUNNING=false
223
+ break
224
+ fi
225
+ done
215
226
ALL_DEPS_RUNNING=true
216
227
for dep in ${MULTI_INST_DEPENDENT} ; do
217
228
if [[ ! -z $DEV ]]; then
@@ -225,7 +236,7 @@ wait() {
225
236
fi
226
237
done
227
238
228
- if [[ x" $RUNNING " == x" true" && x" $ALL_DEPS_RUNNING " == x" true" ]]; then
239
+ if [[ x" $ALL_PEERS_RUNNING " == x" true" && x" $ALL_DEPS_RUNNING " == x" true" ]]; then
229
240
break
230
241
else
231
242
sleep 1
@@ -243,7 +254,7 @@ wait() {
243
254
done
244
255
245
256
if [[ ! -z $DEV ]]; then
246
- /usr/bin/docker-wait-any -s ${SERVICE} $DEV -d $ {PEER}$DEV ${ALL_DEPS}
257
+ /usr/bin/docker-wait-any -s ${SERVICE} $DEV -d ` printf " %s $DEV " $ {PEER}` ${ALL_DEPS}
247
258
else
248
259
/usr/bin/docker-wait-any -s ${SERVICE} -d ${PEER} ${ALL_DEPS}
249
260
fi
@@ -283,6 +294,17 @@ stop() {
283
294
stop_peer_and_dependent_services
284
295
}
285
296
297
+ function check_peer_gbsyncd()
298
+ {
299
+ PLATFORM=` $SONIC_DB_CLI CONFIG_DB hget ' DEVICE_METADATA|localhost' platform`
300
+ HWSKU=` $SONIC_DB_CLI CONFIG_DB hget ' DEVICE_METADATA|localhost' hwsku`
301
+ GEARBOX_CONFIG=/usr/share/sonic/device/$PLATFORM /$HWSKU /$DEV /gearbox_config.json
302
+
303
+ if [ -f $GEARBOX_CONFIG ]; then
304
+ PEER=" $PEER gbsyncd"
305
+ fi
306
+ }
307
+
286
308
if [ " $DEV " ]; then
287
309
NET_NS=" $NAMESPACE_PREFIX$DEV " # name of the network namespace
288
310
SONIC_DB_CLI=" sonic-db-cli -n $NET_NS "
291
313
SONIC_DB_CLI=" sonic-db-cli"
292
314
fi
293
315
316
+ check_peer_gbsyncd
294
317
read_dependent_services
295
318
296
319
case " $1 " in
0 commit comments