From 21e5c46a802e8ee9a09ad256ab44096fb7063603 Mon Sep 17 00:00:00 2001 From: sujkang Date: Thu, 14 Jan 2021 20:10:26 -0800 Subject: [PATCH 1/4] Remove the warning message and change the config file --- pcieutil/main.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pcieutil/main.py b/pcieutil/main.py index de671b38a2..72565c44e2 100644 --- a/pcieutil/main.py +++ b/pcieutil/main.py @@ -41,22 +41,17 @@ 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 + sys.path.append(os.path.abspath(platform_path)) + 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 ==================== @@ -131,7 +126,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("Generate config file pcie.yaml under path %s" % platform_path) if __name__ == '__main__': From 0adc0ab9639ad22b699969b8da37b5f965e1613d Mon Sep 17 00:00:00 2001 From: sujkang Date: Mon, 18 Jan 2021 00:40:38 -0800 Subject: [PATCH 2/4] remove unnecessary system path append --- pcieutil/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pcieutil/main.py b/pcieutil/main.py index 72565c44e2..efdaf4ff46 100644 --- a/pcieutil/main.py +++ b/pcieutil/main.py @@ -46,7 +46,6 @@ def load_platform_pcieutil(): # Load platform module from source try: platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs() - sys.path.append(os.path.abspath(platform_path)) from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil platform_pcieutil = PcieUtil(platform_path) except ImportError as e: From 376a6618f03b97fe973ce7b9e6065c67171b279c Mon Sep 17 00:00:00 2001 From: sujkang Date: Wed, 3 Feb 2021 14:50:26 -0800 Subject: [PATCH 3/4] Review comments --- pcieutil/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcieutil/main.py b/pcieutil/main.py index efdaf4ff46..0f23939968 100644 --- a/pcieutil/main.py +++ b/pcieutil/main.py @@ -21,7 +21,7 @@ # Global platform-specific psuutil class instance platform_pcieutil = None -platform_plugins_path = None +platform_path = None log = logger.Logger(SYSLOG_IDENTIFIER) @@ -125,7 +125,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_path) + click.echo("Generate config file '{}/pcie.yaml'".format(platform_path)) if __name__ == '__main__': From a0866b42b7250e93dbc1dbfd883613f6081228b3 Mon Sep 17 00:00:00 2001 From: sujkang Date: Wed, 3 Feb 2021 16:56:37 -0800 Subject: [PATCH 4/4] Review comments --- pcieutil/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcieutil/main.py b/pcieutil/main.py index 0f23939968..9d5a4efb18 100644 --- a/pcieutil/main.py +++ b/pcieutil/main.py @@ -125,7 +125,7 @@ def check(): def generate(): '''Generate config file with current pci device''' platform_pcieutil.dump_conf_yaml() - click.echo("Generate config file '{}/pcie.yaml'".format(platform_path)) + click.echo("Generated config file '{}/pcie.yaml'".format(platform_path)) if __name__ == '__main__':