Skip to content

Commit

Permalink
[pcied] Remove unnecessary message and move the configuration path (#144
Browse files Browse the repository at this point in the history
)

[pcied] Remove unnecessary message and move the configuration path from plugin directory to platform directory

This PR fixes sonic-net#5819 and fixes sonic-net#6437.

Remove unnecessary repeated message
Move the configuration path from plugin directory to platform directory
  • Loading branch information
sujinmkang authored Feb 9, 2021
1 parent 9080fda commit bd7830b
Showing 1 changed file with 6 additions and 14 deletions.
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(daemon_base.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 Down Expand Up @@ -82,17 +81,11 @@ class DaemonPcied(daemon_base.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 @@ -184,6 +177,5 @@ def main():
pcied = DaemonPcied(SYSLOG_IDENTIFIER)
pcied.run()


if __name__ == '__main__':
main()

0 comments on commit bd7830b

Please sign in to comment.