Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pcied] Remove unnecessary message and move the configuration path #144

Merged
merged 2 commits into from
Feb 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions sonic-pcied/scripts/pcied
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3

"""
pcied
Expand Down Expand Up @@ -41,8 +41,7 @@ class DaemonPcied(DaemonBase):
super(DaemonPcied, self).__init__(log_identifier)

(platform_path, _) = device_info.get_paths_to_platform_and_hwsku_dirs()
pciefilePath = os.path.join(platform_path, "plugins", PCIE_CONF_FILE)
sys.path.append(os.path.abspath(pciefilePath))
pciefilePath = os.path.join(platform_path, PCIE_CONF_FILE)
if not os.path.exists(pciefilePath):
self.log_error("Platform pcie configuration file doesn't exist! Exiting ...")
sys.exit("Platform PCIe Configuration file doesn't exist!")
Expand All @@ -57,17 +56,11 @@ class DaemonPcied(DaemonBase):
def check_pcie_devices(self):
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:
self.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:
self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e
self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e

resultInfo = platform_pcieutil.get_pcie_check()
err = 0
Expand Down Expand Up @@ -141,6 +134,5 @@ def main():
pcied = DaemonPcied(SYSLOG_IDENTIFIER)
pcied.run()


if __name__ == '__main__':
main()