Skip to content

Commit

Permalink
Revert "[Mellanox] Redirect ethtool stderr to subprocess for better e…
Browse files Browse the repository at this point in the history
…rror log (#12038)" (#12184)

This reverts commit 9750cb4.

There is a PR to handle master branch revert: #12183

- Why I did it
The PR to be reverted introduced many notice logs every 1 minute if SFP is not plugged:

Cannot get module EEPROM information: Input/output error
Before the "bad" PR, the message format is like this:

INFO pmon#supervisord: xcvrd Cannot get module EEPROM information: Input/output error
It was truncated by rsyslog because every message is the same. However, the "bad" PR introduces SFP index to the message:

NOTICE pmon#xcvrd: Failed to get EEPROM data for sfp 39: Cannot get module EEPROM information: Input/output error
Rsyslog no longer truncate such log and many such messages are flooded to syslog.

- How I did it
Revert the PR

- How to verify it
Manual test
  • Loading branch information
Junchao-Mellanox authored Sep 28, 2022
1 parent 1c5abca commit ef84a41
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,14 @@ def _read_eeprom_specific_bytes(self, offset, num_bytes):
try:
output = subprocess.check_output(ethtool_cmd,
shell=True,
universal_newlines=True,
stderr=subprocess.PIPE)
universal_newlines=True)
output_lines = output.splitlines()
first_line_raw = output_lines[0]
if "Offset" in first_line_raw:
for line in output_lines[2:]:
line_split = line.split()
eeprom_raw = eeprom_raw + line_split[1:]
except subprocess.CalledProcessError as e:
logger.log_notice("Failed to get EEPROM data for sfp {}: {}".format(self.index, e.stderr))
return None

eeprom_raw = list(map(lambda h: int(h, base=16), eeprom_raw))
Expand Down

0 comments on commit ef84a41

Please sign in to comment.