Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T2-Route-Conv: Process Crash Optimization #21587

Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions dockers/docker-fpm-frr/base_image_files/TSB
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ if [ -z "$STARTED_BY_TSA_TSB_SERVICE" ]; then
[[ $(/bin/systemctl show $service --property SubState --value) == "running" ]]; then
echo "Stopping $service before configuring TSB"
systemctl stop $service
if sonic-db-cli CONFIG_DB HDEL "BGP_DEVICE_GLOBAL|STATE" "tsa_tsb_service" >/dev/null; then
echo "Successfully removed TSA-TSB service flag."
else
echo "Failed to remove TSA-TSB service flag!" >&2
fi
fi
fi

Expand Down
23 changes: 20 additions & 3 deletions files/scripts/startup_tsa_tsb.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,33 @@ def config_tsa():
if tsa_ena == True:
logger.log_info("Configuring TSA")
subprocess.check_output(['TSA']).strip()
logger.log_info("Setting TSA-TSB service field in CONFIG_DB")
subprocess.check_output([
'sonic-db-cli', 'CONFIG_DB', 'HSET', 'BGP_DEVICE_GLOBAL|STATE', 'tsa_tsb_service', 'running']).strip()
else:
if num_asics > 1:
logger.log_info("Either TSA is already configured or switch sub_role is not Frontend - not configuring TSA")
#check if tsa_tsb service is already running, restart the timer
try:
startup_tsa_tsb_service_status = subprocess.check_output([
'sonic-db-cli', 'CONFIG_DB', 'HGET', 'BGP_DEVICE_GLOBAL|STATE', 'tsa_tsb_service'
]).strip().decode('utf-8') # Convert bytes to string
except subprocess.CalledProcessError:
startup_tsa_tsb_service_status = None # Default if the field is missing
if startup_tsa_tsb_service_status == 'running':
logger.log_info("TSA-TSB service is already running, just restart the timer")
return True
else:
logger.log_info("Either TSA is already configured - not configuring TSA")
if num_asics > 1:
logger.log_info("Either TSA is already configured or switch sub_role is not Frontend - not configuring TSA")
else:
logger.log_info("Either TSA is already configured - not configuring TSA")
return tsa_ena

def config_tsb():
logger.log_info("Configuring TSB")
subprocess.check_output(['TSB']).strip()
logger.log_info("removing the TSA-TSB service field from CONFIG_DB")
subprocess.check_output([
'sonic-db-cli', 'CONFIG_DB', 'HDEL', 'BGP_DEVICE_GLOBAL|STATE', 'tsa_tsb_service']).strip()
tsb_issued = True
return

Expand Down
13 changes: 8 additions & 5 deletions files/scripts/swss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DEBUGLOG="/tmp/swss-syncd-debug$DEV.log"
LOCKFILE="/tmp/swss-syncd-lock$DEV"
NAMESPACE_PREFIX="asic"
ETC_SONIC_PATH="/etc/sonic/"

TSA_TSB_SERVICE="startup_tsa_tsb.service"

. /usr/local/bin/asic_status.sh

Expand Down Expand Up @@ -109,9 +109,9 @@ function clean_up_tables()

# This function cleans up the chassis db table entries created ONLY by this asic
# This is used to do the clean up operation when the line card / asic reboots
# When the asic/lc is RE-booting, the chassis db server is supposed to be running
# in the supervisor. So the clean up is done when only the chassis db connectable.
# Otherwise no need to do the clean up since both the supervisor and line card may be
# When the asic/lc is RE-booting, the chassis db server is supposed to be running
# in the supervisor. So the clean up is done when only the chassis db connectable.
# Otherwise no need to do the clean up since both the supervisor and line card may be
# rebooting (the whole chassis scenario)
# The clean up operation is required to delete only those entries created by
# the asic that is rebooted. Entries from the following tables are deleted in the order
Expand Down Expand Up @@ -212,7 +212,7 @@ function clean_up_chassis_db_tables()
debug "Chassis db clean up for ${SERVICE}$DEV. Number of SYSTEM_LAG_MEMBER_TABLE entries deleted: $num_lag_mem"

# Wait for some time before deleting system lag so that the all the memebers of the
# system lag will be cleared.
# system lag will be cleared.
# This delay is needed only if some system lag members were deleted

if [[ $num_lag_mem > 0 ]]; then
Expand Down Expand Up @@ -258,6 +258,9 @@ start_peer_and_dependent_services() {
check_warm_boot

if [[ x"$WARM_BOOT" != x"true" ]]; then
echo "${SERVICE}$DEV: starting TSA-TSB service"
/bin/systemctl restart $TSA_TSB_SERVICE

for peer in ${PEER}; do
if [[ ! -z $DEV ]]; then
/bin/systemctl start ${peer}@$DEV
Expand Down
Loading