Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function waitForAllInstanceDatabaseConfigJsonFilesReady()
function postStartAction()
{
{%- if docker_container_name == "database" %}
midplane_ip=""
CHASSISDB_CONF="/usr/share/sonic/device/$PLATFORM/chassisdb.conf"
[ -f $CHASSISDB_CONF ] && source $CHASSISDB_CONF
if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then
Expand Down Expand Up @@ -198,6 +199,11 @@ function postStartAction()
ip netns exec "$NET_NS" ip addr add $slot_ip_address/$slot_subnet_mask dev eth1
ip netns exec "$NET_NS" ip link set dev eth1 up

# Don't run for supervisor
if [[ "${slot_id}" != "${supervisor_slot_id}" ]]; then
midplane_ip=$slot_ip_address
fi

# Allow localnet routing on the new interfaces if midplane is using a
# subnet in the 127/8 range.
if [[ "${midplane_subnet#127}" != "$midplane_subnet" ]]; then
Expand Down Expand Up @@ -300,6 +306,14 @@ function postStartAction()
REDIS_BMP_SOCK="/var/run/redis/redis_bmp.sock"
chgrp -f redis $REDIS_SOCK && chmod -f 0760 $REDIS_SOCK
chgrp -f redis $REDIS_BMP_SOCK && chmod -f 0760 $REDIS_BMP_SOCK

if [[ $DEV && $midplane_ip ]]; then
IFS=_ read ip port < <(jq -r '.INSTANCES | [.redis.hostname, .redis.port] | join("_")' /var/run/redis$DEV/sonic-db/database_config.json)
bound_ips=$(redis-cli --raw -h $ip -p $port config get bind | sed -n '2,2 p')
redis-cli -h $ip -p $port config set bind "$bound_ips $midplane_ip"
redis-cli -h $ip -p $port config rewrite
fi

{%- elif docker_container_name == "swss" %}
# Wait until swss container state is Running
until [[ ($(docker inspect -f {{"'{{.State.Running}}'"}} swss$DEV) == "true") ]]; do
Expand Down
Loading