From e48eb55ce7ce966e8cf13604eb64f13d77c2973d Mon Sep 17 00:00:00 2001 From: Sujin Kang Date: Mon, 8 Feb 2021 20:02:42 -0800 Subject: [PATCH] [pcieutil] Remove the warning message and change the config file location (#1362) - What I did Fixes Azure/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 --- pcieutil/main.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/pcieutil/main.py b/pcieutil/main.py index 3c250e24a751..807675493b06 100644 --- a/pcieutil/main.py +++ b/pcieutil/main.py @@ -26,7 +26,7 @@ # Global platform-specific psuutil class instance platform_pcieutil = None -platform_plugins_path = None +platform_path = None log = logger.Logger(SYSLOG_IDENTIFIER) @@ -46,22 +46,16 @@ def print_result(name, result): def load_platform_pcieutil(): global platform_pcieutil - global platform_plugins_path + global platform_path # Load platform module from source try: platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs() - platform_plugins_path = os.path.join(platform_path, "plugins") - sys.path.append(os.path.abspath(platform_plugins_path)) - from pcieutil import PcieUtil + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil + platform_pcieutil = PcieUtil(platform_path) except ImportError as e: - log.log_warning("Failed to load platform-specific PcieUtil module. Falling back to the common implementation") - try: - from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil - platform_pcieutil = PcieUtil(platform_plugins_path) - except ImportError as e: - log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True) - raise e + log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True) + raise e # ==================== CLI commands and groups ==================== @@ -298,7 +292,7 @@ def check(): def generate(): '''Generate config file with current pci device''' platform_pcieutil.dump_conf_yaml() - click.echo("Generate config file pcie.yaml under path %s" % platform_plugins_path) + click.echo("Generated config file '{}/pcie.yaml'".format(platform_path)) if __name__ == '__main__':