Skip to content

Commit

Permalink
[multi-asic]: remove load_sonic_global_db_config calls (sonic-net#8173)
Browse files Browse the repository at this point in the history
#### Why I did it
Remove the call to `SonicDBConfig.load_sonic_global_db_config()` in the multi asic functions.
The expection is the client calling this function will call `SonicDBConfig.load_sonic_global_db_config()`

This PR is dependent on the PR sonic-net/sonic-utilities#1712 
#### How to verify it
compile sonic-utilities
  • Loading branch information
arlakshm authored and Carl Keene committed Aug 7, 2021
1 parent 1942bda commit 1f8e725
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/sonic-host-services/scripts/caclmgrd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ try:
import threading
import time

from sonic_py_common import daemon_base, device_info
from sonic_py_common import daemon_base, device_info, multi_asic
from swsscommon import swsscommon
except ImportError as err:
raise ImportError("%s - required module not found" % str(err))
Expand Down Expand Up @@ -108,7 +108,7 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
self.namespace_docker_mgmt_ip = {}
self.namespace_docker_mgmt_ipv6 = {}

namespaces = device_info.get_all_namespaces()
namespaces = multi_asic.get_all_namespaces()
for front_asic_namespace in namespaces['front_ns']:
self.update_thread[front_asic_namespace] = None
self.lock[front_asic_namespace] = threading.Lock()
Expand Down
10 changes: 3 additions & 7 deletions src/sonic-py-common/sonic_py_common/multi_asic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import subprocess

from natsort import natsorted
from swsssdk import ConfigDBConnector
from swsssdk import SonicDBConfig
from swsssdk import SonicV2Connector
from swsscommon import swsscommon

from .device_info import CONTAINER_PLATFORM_PATH
from .device_info import HOST_DEVICE_PATH
Expand Down Expand Up @@ -39,8 +37,7 @@ def connect_config_db_for_ns(namespace=DEFAULT_NAMESPACE):
Returns:
handle to the config_db for a namespace
"""
SonicDBConfig.load_sonic_global_db_config()
config_db = ConfigDBConnector(namespace=namespace)
config_db = swsscommon.ConfigDBConnector(namespace=namespace)
config_db.connect()
return config_db

Expand All @@ -58,8 +55,7 @@ def connect_to_all_dbs_for_ns(namespace=DEFAULT_NAMESPACE):
Returns:
handle to all the dbs for a namespaces
"""
SonicDBConfig.load_sonic_global_db_config()
db = SonicV2Connector(namespace=namespace)
db = swsscommon.SonicV2Connector(namespace=namespace)
for db_id in db.get_db_list():
db.connect(db_id)
return db
Expand Down

0 comments on commit 1f8e725

Please sign in to comment.