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

[warm boot finalizer] only wait for enabled components to reconcile #6454

Merged
merged 7 commits into from
Jan 15, 2021
Merged
Changes from 2 commits
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
40 changes: 34 additions & 6 deletions files/image_config/warmboot-finalizer/finalize-warmboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@

VERBOSE=no

# Check components
COMP_LIST="orchagent neighsyncd bgp natsyncd"
# Define components that needs to reconcile during warm
# boot:
# The key would be the component name that would
# reconcile.
# The value is the name of the service that the
# component belongs to.
declare -A RECONCILE_COMPONENTS=( \
["orchagent"]="swss" \
["neighsyncd"]="swss" \
["bgp"]="bgp" \
["natsyncd"]="nat" \
)
EXP_STATE="reconciled"

ASSISTANT_SCRIPT="/usr/local/bin/neighbor_advertiser"
Expand All @@ -18,6 +28,20 @@ function debug()
}


function filter_component_list()
{
CP_LIST=${!RECONCILE_COMPONENTS[@]}
COMPONENT_LIST=""
for cp in ${CP_LIST}; do
service=${RECONCILE_COMPONENTS[${cp}]}
status=$(sonic-db-cli CONFIG_DB HGET "FEATURE|${service}" state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation looks a little off.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, editing on the target dut. vim setting is wrong there.

if [[ x"${status}" == x"enabled" || x"${status}" == x"always_enabled" ]]; then
COMPONENT_LIST="${COMPONENT_LIST} ${cp}"
fi
done
}


function check_warm_boot()
{
WARM_BOOT=`sonic-db-cli STATE_DB hget "WARM_RESTART_ENABLE_TABLE|system" enable`
Expand Down Expand Up @@ -53,9 +77,9 @@ function check_list()
RET_LIST=''
for comp in $@; do
state=`get_component_state ${comp}`
if [[ x"${state}" != x"${EXP_STATE}" ]]; then
if [[ x"${state}" != x"${EXP_STATE}" ]]; then
RET_LIST="${RET_LIST} ${comp}"
fi
fi
done

echo ${RET_LIST}
Expand Down Expand Up @@ -102,13 +126,17 @@ fi

restore_counters_folder

list=${COMP_LIST}
filter_component_list

debug "Waiting for components: '${COMPONENT_LIST}' to reconcile ..."

list=${COMPONENT_LIST}

# Wait up to 5 minutes
for i in `seq 60`; do
list=`check_list ${list}`
if [[ -z "${list}" ]]; then
break
break
fi
sleep 5
done
Expand Down