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 known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -359,8 +359,7 @@ class SFP(NvidiaSFPCommon):
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:
@ -368,7 +367,6 @@ class SFP(NvidiaSFPCommon):
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))