Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PMON] [Mellanox] fix syseepromd issue on simx #8131

Merged
merged 3 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
#############################################################################
import os
import time
import subprocess

from sonic_py_common.logger import Logger

from sonic_py_common.device_info import get_platform, get_path_to_platform_dir
try:
from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
except ImportError as e:
Expand All @@ -25,6 +26,16 @@
#
EEPROM_SYMLINK = "/var/run/hw-management/eeprom/vpd_info"

platform_name = get_platform()
if 'simx' in platform_name:
platform_path = get_path_to_platform_dir()

if not os.path.exists(EEPROM_SYMLINK):
if not os.path.exists(os.path.dirname(EEPROM_SYMLINK)):
os.makedirs(os.path.dirname(EEPROM_SYMLINK))

subprocess.check_call(['/usr/bin/xxd', '-r', '-p', 'syseeprom.hex', EEPROM_SYMLINK], cwd=platform_path)
Copy link
Collaborator

@nazariig nazariig Jul 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomer-israel why do we need to always check both?

Example:

if not os.path.exists(EEPROM_SYMLINK):
    if not os.path.exists(os.path.dirname(EEPROM_SYMLINK)):
        os.makedirs(os.path.dirname(EEPROM_SYMLINK))

    subprocess.check_call(['/usr/bin/xxd', '-r', '-p', 'syseeprom.hex', EEPROM_SYMLINK], cwd=platform_path)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it as you suggested


class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
RETRIES = 3

Expand Down
17 changes: 10 additions & 7 deletions platform/mellanox/mlnx-platform-api/sonic_platform/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
try:
from sonic_platform_base.platform_base import PlatformBase
from sonic_platform.chassis import Chassis
from sonic_py_common.device_info import get_platform
from . import utils
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
Expand All @@ -15,11 +16,13 @@ class Platform(PlatformBase):
def __init__(self):
PlatformBase.__init__(self)
self._chassis = Chassis()
self._chassis.initialize_psu()
self._chassis.initialize_eeprom()
if utils.is_host():
self._chassis.initialize_components()
self._chassis.initizalize_system_led()
else:
self._chassis.initialize_fan()
self._chassis.initialize_thermals()
platform_name = get_platform()
if "simx" not in platform_name:
self._chassis.initialize_psu()
if utils.is_host():
self._chassis.initialize_components()
self._chassis.initizalize_system_led()
else:
self._chassis.initialize_fan()
self._chassis.initialize_thermals()