Revert "[Mellanox] Redirect ethtool stderr to subprocess for better error log (#12038)" (#12183)

This reverts commit 9750cb4.

There is a PR to handle 202205 branch revert: #12184

- 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
This commit is contained in:
Junchao-Mellanox 2022-09-28 15:15:26 +08:00 committed by GitHub
parent 7666af9403
commit f890606d82
No account linked to committer's email address

View File

@ -359,8 +359,7 @@ class SFP(NvidiaSFPCommon):
try: try:
output = subprocess.check_output(ethtool_cmd, output = subprocess.check_output(ethtool_cmd,
shell=True, shell=True,
universal_newlines=True, universal_newlines=True)
stderr=subprocess.PIPE)
output_lines = output.splitlines() output_lines = output.splitlines()
first_line_raw = output_lines[0] first_line_raw = output_lines[0]
if "Offset" in first_line_raw: if "Offset" in first_line_raw:
@ -368,7 +367,6 @@ class SFP(NvidiaSFPCommon):
line_split = line.split() line_split = line.split()
eeprom_raw = eeprom_raw + line_split[1:] eeprom_raw = eeprom_raw + line_split[1:]
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
logger.log_notice("Failed to get EEPROM data for sfp {}: {}".format(self.index, e.stderr))
return None return None
eeprom_raw = list(map(lambda h: int(h, base=16), eeprom_raw)) eeprom_raw = list(map(lambda h: int(h, base=16), eeprom_raw))