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

Added WDC ssd health #300

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
18 changes: 17 additions & 1 deletion sonic_platform_base/sonic_ssd/ssd_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def __init__(self, diskdev):
"M.2" : { "utility" : INNODISK, "parser" : self.parse_innodisk_info },
"StorFly" : { "utility" : VIRTIUM, "parser" : self.parse_virtium_info },
"Virtium" : { "utility" : VIRTIUM, "parser" : self.parse_virtium_info },
"Swissbit" : { "utility" : SMARTCTL, "parser" : self.parse_swissbit_info },
"WDC" : { "utility" : SMARTCTL, "parser" : self.parse_wdc_ssd_info },
"Swissbit" : { "utility" : SMARTCTL, "parser" : self.parse_swissbit_info }
}

self.dev = diskdev
Expand Down Expand Up @@ -125,6 +126,21 @@ def parse_generic_ssd_info(self):
self.serial = self._parse_re('Serial Number:\s*(.+?)\n', self.ssd_info)
self.firmware = self._parse_re('Firmware Version:\s*(.+?)\n', self.ssd_info)

def parse_wdc_ssd_info(self):
self.model = self._parse_re('Device Model:\s*(.+?)\n', self.ssd_info)
self.serial = self._parse_re('Serial Number:\s*(.+?)\n', self.ssd_info)
self.firmware = self._parse_re('Firmware Version:\s*(.+?)\n', self.ssd_info)
try:
if ("SDASN8Y1T00" == self.model.split(' ')[3]):
self.nand_endurance = 400 * 1000
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @deran1980 - could you please elaborate on why NAND endurance is set to this value?

Copy link
Contributor

Choose a reason for hiding this comment

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

parsed_total_lbas_written = self._parse_re('Total_LBAs_Written\s*.*Offline\s*-\s*\d*', self.vendor_ssd_info)
total_lbas_written = int(self._parse_re('\s{7}\d*', parsed_total_lbas_written).split(' ')[7])
self.health = int(100.0 - (total_lbas_written * 100) / self.nand_endurance)
celsius_str = self._parse_re('Temperature_Celsius\s*.*', self.vendor_ssd_info)
self.temperature = self._parse_re('\d*\s\(Min.*', celsius_str)
except (ValueError, IndexError):
pass

def parse_innodisk_info(self):
if self.vendor_ssd_info:
self.health = self._parse_re('Health:\s*(.+?)%', self.vendor_ssd_info)
Expand Down
Loading