Skip to content

Commit cd6a5a4

Browse files
authored
Support for static and dynamic attrs as part of stormond implementation (#439)
* Added support for INNODISK SMART attributes * Fixed a bug with get_reserved_blocks() function * Added support for Micron and Intel vendors. Fixed a bug with generic temperature parsing. * Renamed ssd_base -> storage_base, added class for common calls, modified child class implementation accordingly * Fixed a looping bug * renamed sonic_ssd --> sonic_storage, removed 'ssd_' prefix from child classes * Cleaned up impl per core algorithm changes, defined in HLD * Renamed SSD and EMMC UTs per naming convention * Made following changes based on prgeor review coments: storage_devices.py: Moved imports to the beginning of file renamed function to _storage_device_object_factory Above function now returns an object storage_common.py: Changed logic to only get reads and writes using psutil library. * Added UTs, fixed bugs in ssd.py surfaced by UTs * Added more UTs, fixed issue surafced by said UTs * Increased coverage, cleaned up SsdUtil * Added more UT coverage * Addressed review comments, changed UT accordingly * Increased UT coverage * Removed the underscore per naming convention * Fixed the following in ssd.py: Changed parse_id_number logic to prevent phantom regex matches Fixed a bug in parse_id_number that was causing the code to disregard vendor_ssd_info Fixed issues with Innodisk and Virtium parsers Fixed a ValueError bug in Virtium parser logic Added UTs to test the various changes * Fixed potential issue with parse_id_number not reconciling leading/trailing spaces * Changed comment to better reflect class intent * Fixed a bug where stormond was calling a function not defined for EmmcUtil objects * Fixed fetch_parse_info error on emmc devices * Added safeguards against vendor utilities failing * switched from logger to syslogger per review * Moved log to within class.
1 parent 862a67c commit cd6a5a4

File tree

12 files changed

+1236
-351
lines changed

12 files changed

+1236
-351
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
'sonic_platform_base',
3838
'sonic_platform_base.sonic_eeprom',
3939
'sonic_platform_base.sonic_sfp',
40-
'sonic_platform_base.sonic_ssd',
40+
'sonic_platform_base.sonic_storage',
4141
'sonic_platform_base.sonic_pcie',
4242
'sonic_platform_base.sonic_thermal_control',
4343
'sonic_platform_base.sonic_xcvr',

sonic_platform_base/sonic_ssd/ssd_generic.py

Lines changed: 0 additions & 267 deletions
This file was deleted.

sonic_platform_base/sonic_ssd/ssd_emmc.py renamed to sonic_platform_base/sonic_storage/emmc.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#
2-
# ssd_emmc.py
2+
# emmc.py
33
#
44
# Implementation of SSD Utility API for eMMC.
55
# It reads eMMC health, model, firmware, and serial from /sys/block/*.
66
#
77

88
try:
99
import os
10-
from .ssd_base import SsdBase
10+
from .storage_common import StorageCommon
1111
except ImportError as e:
1212
raise ImportError(str(e) + "- required module not found")
1313

1414

15-
class EmmcUtil(SsdBase):
15+
class EmmcUtil(StorageCommon):
1616
def __init__(self, diskdev):
1717
self.diskdev = diskdev
1818
self.path = os.path.join('/sys/block', os.path.basename(diskdev))
19+
StorageCommon.__init__(self, diskdev)
1920

2021
def _read_device_entry(self, entry, default=None):
2122
path = os.path.join(self.path, 'device', entry)
@@ -49,3 +50,15 @@ def get_serial(self):
4950

5051
def get_vendor_output(self):
5152
return ''
53+
54+
def get_disk_io_reads(self):
55+
return 'N/A'
56+
57+
def get_disk_io_writes(self):
58+
return 'N/A'
59+
60+
def get_reserved_blocks(self):
61+
return 'N/A'
62+
63+
def fetch_parse_info(self, diskdev=None):
64+
return

0 commit comments

Comments
 (0)