Skip to content

Commit

Permalink
[pcied] Fix pcied failure to load due to 'pcied NameError: name 'self…
Browse files Browse the repository at this point in the history
…' is not defined' (sonic-net#198)

Fix sonic-net/sonic-buildimage#7993

- Fixes wrong log line when Pcie module does not exists that causes the pcied daemon to enter FATAL state.
- Change log level of line "Failed to load platform Pcie module" to notice since this is not an error flow, this is part of the normal loading flow we expect when a vendor didn't supply a Pcie class.
  • Loading branch information
DavidZagury authored Jul 13, 2021
1 parent 3df6757 commit 66e7817
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sonic-pcied/scripts/pcied
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import signal
import sys
import threading

from sonic_py_common import daemon_base, device_info
from sonic_py_common import daemon_base, device_info, logger
from swsscommon import swsscommon

#
Expand All @@ -35,6 +35,8 @@ PCIEUTIL_LOAD_ERROR = 2

platform_pcieutil = None

log = logger.Logger(SYSLOG_IDENTIFIER)

exit_code = 0

# wrapper functions to call the platform api
Expand All @@ -45,12 +47,12 @@ def load_platform_pcieutil():
from sonic_platform.pcie import Pcie
_platform_pcieutil = Pcie(platform_path)
except ImportError as e:
self.log_error("Failed to load platform Pcie module. Error : {}".format(str(e)), True)
log.log_notice("Failed to load platform Pcie module. Error : {}, Fallback to default module".format(str(e)), True)
try:
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
_platform_pcieutil = PcieUtil(platform_path)
except ImportError as e:
self.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
return _platform_pcieutil

def read_id_file(device_name):
Expand Down

0 comments on commit 66e7817

Please sign in to comment.