3987cbd80a
We are moving toward building all Python packages for SONiC as wheel packages rather than Debian packages. This will also allow us to more easily transition to Python 3. Python files are now packaged in "sonic-utilities" Pyhton wheel. Data files are now packaged in "sonic-utilities-data" Debian package. **- How I did it** - Build and install sonic-utilities as a Python package - Remove explicit installation of wheel dependencies, as these will now get installed implicitly by pip when installing sonic-utilities as a wheel - Build and install new sonic-utilities-data package to install data files required by sonic-utilities applications - Update all references to sonic-utilities scripts/entrypoints to either reference the new /usr/local/bin/ location or remove absolute path entirely where applicable Submodule updates: * src/sonic-utilities aa27dd9...2244d7b (5): > Support building sonic-utilities as a Python wheel package instead of a Debian package (#1122) > [consutil] Display remote device name in show command (#1120) > [vrf] fix check state_db error when vrf moving (#1119) > [consutil] Fix issue where the ConfigDBConnector's reference is missing (#1117) > Update to make config load/reload backward compatible. (#1115) * src/sonic-ztp dd025bc...911d622 (1): > Update paths to reflect new sonic-utilities install location, /usr/local/bin/ (#19)
111 lines
2.0 KiB
Bash
Executable File
111 lines
2.0 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
VERBOSE=no
|
|
|
|
# Check components
|
|
COMP_LIST="orchagent neighsyncd bgp natsyncd"
|
|
EXP_STATE="reconciled"
|
|
|
|
ASSISTANT_SCRIPT="/usr/local/bin/neighbor_advertiser"
|
|
|
|
|
|
function debug()
|
|
{
|
|
/usr/bin/logger "WARMBOOT_FINALIZER : $1"
|
|
if [[ x"${VERBOSE}" == x"yes" ]]; then
|
|
echo `date` "- $1"
|
|
fi
|
|
}
|
|
|
|
|
|
function check_warm_boot()
|
|
{
|
|
WARM_BOOT=`sonic-db-cli STATE_DB hget "WARM_RESTART_ENABLE_TABLE|system" enable`
|
|
}
|
|
|
|
|
|
function wait_for_database_service()
|
|
{
|
|
debug "Wait for database to become ready..."
|
|
|
|
# Wait for redis server start before database clean
|
|
until [[ $(sonic-db-cli PING | grep -c PONG) -gt 0 ]]; do
|
|
sleep 1;
|
|
done
|
|
|
|
# Wait for configDB initialization
|
|
until [[ $(sonic-db-cli CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]];
|
|
do sleep 1;
|
|
done
|
|
|
|
debug "Database is ready..."
|
|
}
|
|
|
|
|
|
function get_component_state()
|
|
{
|
|
sonic-db-cli STATE_DB hget "WARM_RESTART_TABLE|$1" state
|
|
}
|
|
|
|
|
|
function check_list()
|
|
{
|
|
RET_LIST=''
|
|
for comp in $@; do
|
|
state=`get_component_state ${comp}`
|
|
if [[ x"${state}" != x"${EXP_STATE}" ]]; then
|
|
RET_LIST="${RET_LIST} ${comp}"
|
|
fi
|
|
done
|
|
|
|
echo ${RET_LIST}
|
|
}
|
|
|
|
|
|
function finalize_warm_boot()
|
|
{
|
|
debug "Finalizing warmboot..."
|
|
sudo config warm_restart disable
|
|
}
|
|
|
|
function stop_control_plane_assistant()
|
|
{
|
|
if [[ -x ${ASSISTANT_SCRIPT} ]]; then
|
|
debug "Tearing down control plane assistant ..."
|
|
${ASSISTANT_SCRIPT} -m reset
|
|
fi
|
|
}
|
|
|
|
|
|
wait_for_database_service
|
|
|
|
check_warm_boot
|
|
|
|
if [[ x"${WARM_BOOT}" != x"true" ]]; then
|
|
debug "warmboot is not enabled ..."
|
|
exit 0
|
|
fi
|
|
|
|
list=${COMP_LIST}
|
|
|
|
# Wait up to 5 minutes
|
|
for i in `seq 60`; do
|
|
list=`check_list ${list}`
|
|
if [[ -z "${list}" ]]; then
|
|
break
|
|
fi
|
|
sleep 5
|
|
done
|
|
|
|
stop_control_plane_assistant
|
|
|
|
# Save DB after stopped control plane assistant to avoid extra entries
|
|
debug "Save in-memory database after warm reboot ..."
|
|
config save -y
|
|
|
|
if [[ -n "${list}" ]]; then
|
|
debug "Some components didn't finish reconcile: ${list} ..."
|
|
fi
|
|
|
|
finalize_warm_boot
|