diff --git a/dockers/docker-orchagent/docker-init.j2 b/dockers/docker-orchagent/docker-init.j2 index 18fc1b57a721..46db99a3166f 100755 --- a/dockers/docker-orchagent/docker-init.j2 +++ b/dockers/docker-orchagent/docker-init.j2 @@ -4,6 +4,7 @@ mkdir -p /etc/swss/config.d/ mkdir -p /etc/supervisor/ mkdir -p /etc/supervisor/conf.d/ + CFGGEN_PARAMS=" \ -d \ {% if ENABLE_ASAN == "y" %} @@ -48,21 +49,24 @@ if [ "$SUBTYPE" == "DualToR" ]; then cp /usr/share/sonic/templates/tunnel_packet_handler.conf /etc/supervisor/conf.d/ fi +IS_SUPERVISOR=/etc/sonic/chassisdb.conf USE_PCI_ID_IN_CHASSIS_STATE_DB=/usr/share/sonic/platform/use_pci_id_chassis ASIC_ID="asic$NAMESPACE_ID" -if [ -f "$USE_PCI_ID_IN_CHASSIS_STATE_DB" ]; then - while true; do - PCI_ID=$(sonic-db-cli -s CHASSIS_STATE_DB HGET "CHASSIS_ASIC_TABLE|$ASIC_ID" asic_pci_address) - if [ -z "$PCI_ID" ]; then - sleep 3 - else - # Update asic_id in CONFIG_DB, which is used by orchagent and fed to syncd - if [[ $PCI_ID == ????:??:??.? ]]; then - sonic-db-cli CONFIG_DB HSET 'DEVICE_METADATA|localhost' 'asic_id' ${PCI_ID#*:} - break +if [ -f "$IS_SUPERVISOR" ]; then + if [ -f "$USE_PCI_ID_IN_CHASSIS_STATE_DB" ]; then + while true; do + PCI_ID=$(sonic-db-cli -s CHASSIS_STATE_DB HGET "CHASSIS_FABRIC_ASIC_TABLE|$ASIC_ID" asic_pci_address) + if [ -z "$PCI_ID" ]; then + sleep 3 + else + # Update asic_id in CONFIG_DB, which is used by orchagent and fed to syncd + if [[ $PCI_ID == ????:??:??.? ]]; then + sonic-db-cli CONFIG_DB HSET 'DEVICE_METADATA|localhost' 'asic_id' ${PCI_ID#*:} + break + fi fi - fi - done + done + fi fi exec /usr/local/bin/supervisord diff --git a/files/scripts/asic_status.py b/files/scripts/asic_status.py index bed21de412fa..81a7aabc9758 100755 --- a/files/scripts/asic_status.py +++ b/files/scripts/asic_status.py @@ -17,7 +17,7 @@ # Constants ==================================================================== # SYSLOG_IDENTIFIER = 'asic_status.py' -CHASSIS_ASIC_INFO_TABLE = 'CHASSIS_ASIC_TABLE' +CHASSIS_FABRIC_ASIC_INFO_TABLE = 'CHASSIS_FABRIC_ASIC_TABLE' SELECT_TIMEOUT_MSECS = 5000 def main(): @@ -40,7 +40,7 @@ def main(): state_db = daemon_base.db_connect("CHASSIS_STATE_DB") sel = swsscommon.Select() - sst = swsscommon.SubscriberStateTable(state_db, CHASSIS_ASIC_INFO_TABLE) + sst = swsscommon.SubscriberStateTable(state_db, CHASSIS_FABRIC_ASIC_INFO_TABLE) sel.addSelectable(sst) while True: diff --git a/src/sonic-py-common/sonic_py_common/multi_asic.py b/src/sonic-py-common/sonic_py_common/multi_asic.py index 54f9a01dec5a..53eb2fdc6485 100644 --- a/src/sonic-py-common/sonic_py_common/multi_asic.py +++ b/src/sonic-py-common/sonic_py_common/multi_asic.py @@ -26,7 +26,7 @@ DEFAULT_NAMESPACE = '' PORT_ROLE = 'role' CHASSIS_STATE_DB='CHASSIS_STATE_DB' -CHASSIS_ASIC_INFO_TABLE='CHASSIS_ASIC_TABLE' +CHASSIS_FABRIC_ASIC_INFO_TABLE='CHASSIS_FABRIC_ASIC_TABLE' # Dictionary to cache config_db connection handle per namespace # to prevent duplicate connections from being opened @@ -478,7 +478,7 @@ def get_asic_presence_list(): # Get asic list from CHASSIS_ASIC_TABLE which lists only the asics # present based on Fabric card detection by the platform. db = swsscommon.DBConnector(CHASSIS_STATE_DB, 0, True) - asic_table = swsscommon.Table(db, CHASSIS_ASIC_INFO_TABLE) + asic_table = swsscommon.Table(db, CHASSIS_FABRIC_ASIC_INFO_TABLE) if asic_table: asics_presence_list = list(asic_table.getKeys()) for asic in asics_presence_list: