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 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
Next Next commit
[warm boot finalizer] only wait for enabled components to reconcile
Define the component with its associated service. Only wait for
components that have associated service enabled to reconcile
during warm reboot.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
yxieca committed Jan 14, 2021

Verified

This commit was signed with the committer’s verified signature.
synfinatic Aaron Turner
commit 9ef805f592d98d2a65a4f6f97824715d7c6ace1b
40 changes: 34 additions & 6 deletions files/image_config/warmboot-finalizer/finalize-warmboot.sh
Original file line number Diff line number Diff line change
@@ -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"
@@ -18,6 +28,20 @@ function debug()
}


function set_component_list()
{
CP_LIST=${!RECONCILE_COMPONENTS[@]}
COMPONENT_LIST=""
for cp in ${CP_LIST}; do
service=${RECONCILE_COMPONENTS[${cp}]}
status=$(show feature status | grep "^${service}" | awk '{ print $2 }')
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic depends on the raw output format of show feature status. If anything changes in this show api, awk might return some other column value. Can this rather be obtained directly from the DB?

$ redis-cli -n 4 HMGET "FEATURE|nat" state
1) "disabled"

$ redis-cli -n 4 HMGET "FEATURE|bgp" state
1) "enabled"

...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea! changed. Thanks!

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`
@@ -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}
@@ -102,13 +126,17 @@ fi

restore_counters_folder

list=${COMP_LIST}
set_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