Added support to add gbsyncd in Feature Table of Host Config DB (#11754)

Why I did:

In case of multi-asic platforms gbsyncd is not getting added to Feature Table of Host Config DB. Without this container_checker complains of not needed gbsyncd container's are running.

How I did:
Update Both Host and Namespace config db when gbsyncd docker is starting.

How I verify:
Verified on Multi-asic platforms.
This commit is contained in:
abdosi 2022-08-17 14:02:21 -07:00 committed by Ying Xie
parent 75844e6b2a
commit 0355caf20b

View File

@ -3,11 +3,15 @@
. /usr/local/bin/syncd_common.sh . /usr/local/bin/syncd_common.sh
function startplatform() { function startplatform() {
# Add gbsyncd to FEATURE table, if not in. It did have same config as syncd.
if [ -z $($SONIC_DB_CLI CONFIG_DB HGET 'FEATURE|gbsyncd' state) ]; then declare -a DbCliArray=($SONIC_DB_CLI $SONIC_DB_NS_CLI)
local CMD="local r=redis.call('DUMP', KEYS[1]); redis.call('RESTORE', KEYS[2], 0, r)" for DB_CLI in ${DbCliArray[@]}; do
$SONIC_DB_CLI CONFIG_DB EVAL "$CMD" 2 'FEATURE|syncd' 'FEATURE|gbsyncd' # Add gbsyncd to FEATURE table, if not in. It did have same config as syncd.
fi if [ -z $($DB_CLI CONFIG_DB HGET 'FEATURE|gbsyncd' state) ]; then
local CMD="local r=redis.call('DUMP', KEYS[1]); redis.call('RESTORE', KEYS[2], 0, r)"
$DB_CLI CONFIG_DB EVAL "$CMD" 2 'FEATURE|syncd' 'FEATURE|gbsyncd'
fi
done
} }
function waitplatform() { function waitplatform() {
@ -30,12 +34,11 @@ PEER="swss"
DEBUGLOG="/tmp/swss-$SERVICE-debug$DEV.log" DEBUGLOG="/tmp/swss-$SERVICE-debug$DEV.log"
LOCKFILE="/tmp/swss-$SERVICE-lock$DEV" LOCKFILE="/tmp/swss-$SERVICE-lock$DEV"
NAMESPACE_PREFIX="asic" NAMESPACE_PREFIX="asic"
SONIC_DB_CLI="sonic-db-cli"
SONIC_DB_NS_CLI="sonic-db-cli"
if [ "$DEV" ]; then if [ "$DEV" ]; then
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace
SONIC_DB_CLI="sonic-db-cli -n $NET_NS" SONIC_DB_NS_CLI="sonic-db-cli -n $NET_NS"
else
NET_NS=""
SONIC_DB_CLI="sonic-db-cli"
fi fi
case "$1" in case "$1" in