@@ -171,6 +171,7 @@ function waitForAllInstanceDatabaseConfigJsonFilesReady()
171171function postStartAction()
172172{
173173{%- if docker_container_name == " database" %}
174+ midplane_ip=" "
174175 CHASSISDB_CONF=" /usr/share/sonic/device/$PLATFORM /chassisdb.conf"
175176 [ -f $CHASSISDB_CONF ] && source $CHASSISDB_CONF
176177 if [[ " $DEV " && $DATABASE_TYPE != " dpudb" ]]; then
@@ -222,6 +223,11 @@ function postStartAction()
222223 ip netns exec " $NET_NS " ip addr add $slot_ip_address /$slot_subnet_mask dev eth1
223224 ip netns exec " $NET_NS " ip link set dev eth1 up
224225
226+ # Don't run for supervisor
227+ if [[ " ${slot_id} " != " ${supervisor_slot_id} " ]]; then
228+ midplane_ip=$slot_ip_address
229+ fi
230+
225231 # Allow localnet routing on the new interfaces if midplane is using a
226232 # subnet in the 127/8 range.
227233 if [[ " ${midplane_subnet# 127} " != " $midplane_subnet " ]]; then
@@ -324,6 +330,14 @@ function postStartAction()
324330 REDIS_SOCK=" /var/run/redis-chassis/redis_chassis.sock"
325331 fi
326332 chgrp -f redis $REDIS_SOCK && chmod -f 0760 $REDIS_SOCK
333+
334+ if [[ $DEV && $midplane_ip ]]; then
335+ IFS=_ read ip port < <( jq -r ' .INSTANCES | [.redis.hostname, .redis.port] | join("_")' /var/run/redis$DEV /sonic-db/database_config.json)
336+ bound_ips=$( redis-cli --raw -h $ip -p $port config get bind | sed -n ' 2,2 p' )
337+ redis-cli -h $ip -p $port config set bind " $bound_ips $midplane_ip "
338+ redis-cli -h $ip -p $port config rewrite
339+ fi
340+
327341{%- elif docker_container_name == " swss" %}
328342 # Wait until swss container state is Running
329343 until [[ ($( docker inspect -f {{" '{{.State.Running}}'" }} swss$DEV ) == " true" ) ]]; do
0 commit comments