Skip to content

Commit

Permalink
Merge pull request sonic-net#81 from mssonicbld/sonicbld/202205-merge
Browse files Browse the repository at this point in the history
[code sync] Merge code from sonic-net/sonic-buildimage:202205 to 202205
  • Loading branch information
mssonicbld authored Aug 12, 2023
2 parents 7054f6d + f2e0f22 commit 75afbcf
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 35 deletions.
21 changes: 16 additions & 5 deletions dockers/docker-snmp/snmpd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,27 @@ agentAddress {{ protocol(agentip) }}:[{{ agentip }}]{% if port %}:{{ port }}{% e
{% endfor %}
{% elif NAMESPACE_COUNT is not defined or NAMESPACE_COUNT|int <= 1 %}
{% if MGMT_INTERFACE is defined %}
{% for if, ip in MGMT_INTERFACE %}
{% set agentip = ip.split('/')[0] %}
agentAddress {{ protocol(agentip) }}:[{{ agentip }}]:161
{% for intf, ip in MGMT_INTERFACE %}
{% set agentip = ip.split('/')[0]|lower %}
{% set zoneid = '' %}
# Use interface as zoneid for link local ipv6
{% if agentip.startswith('fe80') %}
{% set zoneid = '%' + intf %}
{% endif %}
agentAddress {{ protocol(agentip) }}:[{{ agentip }}{{ zoneid }}]:161
{% endfor %}
{% endif %}
{% if LOOPBACK_INTERFACE is defined %}
{% for lo in LOOPBACK_INTERFACE %}
{% if lo | length == 2 %}
{% set agentip = lo[1].split('/')[0] %}
agentAddress {{ protocol(agentip) }}:[{{ agentip }}]:161
{% set intf = lo[0] %}
{% set agentip = lo[1].split('/')[0]|lower %}
{% set zoneid = '' %}
# Use interface as zoneid for link local ipv6
{% if agentip.startswith('fe80') %}
{% set zoneid = '%' + intf %}
{% endif %}
agentAddress {{ protocol(agentip) }}:[{{ agentip }}{{ zoneid }}]:161
{% endif %}
{% endfor %}
{% endif %}
Expand Down
27 changes: 9 additions & 18 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ function postStartAction()
($(docker exec -i database$DEV sonic-db-cli PING | grep -c PONG) -gt 0) ]]; do
sleep 1;
done

if [[ ("$BOOT_TYPE" == "warm" || "$BOOT_TYPE" == "fastfast" || "$BOOT_TYPE" == "fast") && -f $WARM_DIR/dump.rdb ]]; then
# retain the dump file from last boot for debugging purposes
mv $WARM_DIR/dump.rdb $WARM_DIR/dump.rdb.old
Expand All @@ -237,28 +238,18 @@ function postStartAction()
$SONIC_CFGGEN -j /etc/sonic/config_db$DEV.json --write-to-db
fi
fi

if [[ "$BOOT_TYPE" == "fast" ]]; then
# set the key to expire in 3 minutes
$SONIC_DB_CLI STATE_DB SET "FAST_REBOOT|system" "1" "EX" "180"
fi

$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
fi

if [ -e /tmp/pending_config_migration ]; then
if [ -e /tmp/pending_config_migration ] || [ -e /tmp/pending_config_initialization ]; then
# this is first boot to a new image, config-setup execution is pending.
# For fast/cold reboot case, DB contains nothing at this point
# Call db_migrator after config-setup loads the config (from old config or minigraph)
echo "Delaying db_migrator until config migration is over"
# for warmboot case, DB is loaded but migration is still pending
# For firstbboot/fast/cold reboot case, DB contains nothing at this point
# unset CONFIG_DB_INITIALIZED to indicate pending config load and migration
# This flag will be set to "1" after DB migration/initialization is completed as part of config-setup
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "0"
else
# this is not a first time boot to a new image. Datbase container starts w/ old pre-existing config
if [[ -x /usr/local/bin/db_migrator.py ]]; then
# Migrate the DB to the latest schema version if needed
if [ -z "$DEV" ]; then
/usr/local/bin/db_migrator.py -o migrate
fi
fi
# set CONFIG_DB_INITIALIZED to indicate end of config load and migration
$SONIC_DB_CLI CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
fi
# Add redis UDS to the redis group and give read/write access to the group
REDIS_SOCK="/var/run/redis${DEV}/redis.sock"
Expand Down
4 changes: 3 additions & 1 deletion files/image_config/config-setup/config-setup
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ do_config_initialization()
fi

rm -f /tmp/pending_config_initialization
sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
}

# Restore config-setup post migration hooks from a backup copy
Expand Down Expand Up @@ -305,13 +306,14 @@ check_all_config_db_present()
}

# DB schema is subject to change between two images
# Perform DB schema migration after loading backup config from previous image
# Perform DB schema migration after loading backup config/minigraph from previous image
do_db_migration()
{
if [[ -x /usr/local/bin/db_migrator.py ]]; then
# Migrate the DB to the latest schema version if needed
/usr/local/bin/db_migrator.py -o migrate
fi
sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
}

# Perform configuration migration from backup copy.
Expand Down
2 changes: 1 addition & 1 deletion files/image_config/warmboot-finalizer/finalize-warmboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function wait_for_database_service()
done

# Wait for configDB initialization
until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];
until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") -eq 1 ]];
do sleep 1;
done

Expand Down
16 changes: 12 additions & 4 deletions files/scripts/swss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function wait_for_database_service()
done

# Wait for configDB initialization
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") -eq 1 ]];
do sleep 1;
done
}
Expand Down Expand Up @@ -316,6 +316,16 @@ function check_macsec()
fi
}

function check_add_bgp_dependency()
{
if ! is_chassis_supervisor; then
if [ "$DEV" ]; then
DEPENDENT="${DEPENDENT} bgp@${DEV}"
else
DEPENDENT="${DEPENDENT} bgp"
fi
fi
}
function check_ports_present()
{
PORT_CONFIG_INI=/usr/share/sonic/device/$PLATFORM/$HWSKU/$DEV/port_config.ini
Expand All @@ -335,19 +345,17 @@ MULTI_INST_DEPENDENT=""
if [ "$DEV" ]; then
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace
SONIC_DB_CLI="sonic-db-cli -n $NET_NS"
DEPENDENT+=" bgp@${DEV}"
else
NET_NS=""
SONIC_DB_CLI="sonic-db-cli"
DEPENDENT+=" bgp"
fi

PLATFORM=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' platform`
HWSKU=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' hwsku`

check_peer_gbsyncd
check_macsec

check_add_bgp_dependency
check_ports_present
PORTS_PRESENT=$?

Expand Down
2 changes: 1 addition & 1 deletion files/scripts/syncd_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function wait_for_database_service()
done

# Wait for configDB initialization
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];
until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") -eq 1 ]];
do sleep 1;
done
}
Expand Down
Binary file not shown.
1 change: 0 additions & 1 deletion platform/mellanox/mlnx-sai/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
pushd SAI-Implementation
pushd mlnx_sai

chmod a+x autogen.sh
debuild -e 'make_extra_flags="DEFS=-DACS_OS -DCONFIG_SYSLOG"' -us -uc -d -b
popd

Expand Down
2 changes: 1 addition & 1 deletion src/sonic-platform-common
2 changes: 1 addition & 1 deletion src/sonic-platform-daemons
2 changes: 1 addition & 1 deletion src/sonic-swss

0 comments on commit 75afbcf

Please sign in to comment.