Skip to content

Commit e48eb55

Browse files
authored
[pcieutil] Remove the warning message and change the config file location (#1362)
- What I did Fixes sonic-net/sonic-buildimage#6437 - How I did it Changed the configuration file path from plugin to platform directory - How to verify it Verify on the device
1 parent 794cdd3 commit e48eb55

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

pcieutil/main.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
# Global platform-specific psuutil class instance
2828
platform_pcieutil = None
29-
platform_plugins_path = None
29+
platform_path = None
3030

3131
log = logger.Logger(SYSLOG_IDENTIFIER)
3232

@@ -46,22 +46,16 @@ def print_result(name, result):
4646

4747
def load_platform_pcieutil():
4848
global platform_pcieutil
49-
global platform_plugins_path
49+
global platform_path
5050

5151
# Load platform module from source
5252
try:
5353
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
54-
platform_plugins_path = os.path.join(platform_path, "plugins")
55-
sys.path.append(os.path.abspath(platform_plugins_path))
56-
from pcieutil import PcieUtil
54+
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
55+
platform_pcieutil = PcieUtil(platform_path)
5756
except ImportError as e:
58-
log.log_warning("Failed to load platform-specific PcieUtil module. Falling back to the common implementation")
59-
try:
60-
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
61-
platform_pcieutil = PcieUtil(platform_plugins_path)
62-
except ImportError as e:
63-
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
64-
raise e
57+
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
58+
raise e
6559

6660

6761
# ==================== CLI commands and groups ====================
@@ -298,7 +292,7 @@ def check():
298292
def generate():
299293
'''Generate config file with current pci device'''
300294
platform_pcieutil.dump_conf_yaml()
301-
click.echo("Generate config file pcie.yaml under path %s" % platform_plugins_path)
295+
click.echo("Generated config file '{}/pcie.yaml'".format(platform_path))
302296

303297

304298
if __name__ == '__main__':

0 commit comments

Comments
 (0)