|
1 |
| -#!/usr/bin/env python2 |
| 1 | +#!/usr/bin/env python3 |
2 | 2 |
|
3 | 3 | """
|
4 | 4 | pcied
|
@@ -41,8 +41,7 @@ class DaemonPcied(daemon_base.DaemonBase):
|
41 | 41 | super(DaemonPcied, self).__init__(log_identifier)
|
42 | 42 |
|
43 | 43 | (platform_path, _) = device_info.get_paths_to_platform_and_hwsku_dirs()
|
44 |
| - pciefilePath = os.path.join(platform_path, "plugins", PCIE_CONF_FILE) |
45 |
| - sys.path.append(os.path.abspath(pciefilePath)) |
| 44 | + pciefilePath = os.path.join(platform_path, PCIE_CONF_FILE) |
46 | 45 | if not os.path.exists(pciefilePath):
|
47 | 46 | self.log_error("Platform pcie configuration file doesn't exist! Exiting ...")
|
48 | 47 | sys.exit("Platform PCIe Configuration file doesn't exist!")
|
@@ -82,17 +81,11 @@ class DaemonPcied(daemon_base.DaemonBase):
|
82 | 81 | def check_pcie_devices(self):
|
83 | 82 | try:
|
84 | 83 | platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
|
85 |
| - platform_plugins_path = os.path.join(platform_path, "plugins") |
86 |
| - sys.path.append(os.path.abspath(platform_plugins_path)) |
87 |
| - from pcieutil import PcieUtil |
| 84 | + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil |
| 85 | + platform_pcieutil = PcieUtil(platform_path) |
88 | 86 | except ImportError as e:
|
89 |
| - self.log_warning("Failed to load platform-specific PcieUtil module. Falling back to the common implementation") |
90 |
| - try: |
91 |
| - from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil |
92 |
| - platform_pcieutil = PcieUtil(platform_plugins_path) |
93 |
| - except ImportError as e: |
94 |
| - self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True) |
95 |
| - raise e |
| 87 | + self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True) |
| 88 | + raise e |
96 | 89 |
|
97 | 90 | resultInfo = platform_pcieutil.get_pcie_check()
|
98 | 91 | err = 0
|
@@ -184,6 +177,5 @@ def main():
|
184 | 177 | pcied = DaemonPcied(SYSLOG_IDENTIFIER)
|
185 | 178 | pcied.run()
|
186 | 179 |
|
187 |
| - |
188 | 180 | if __name__ == '__main__':
|
189 | 181 | main()
|
0 commit comments