Skip to content

Commit

Permalink
[SSD] deduce vendor name from part number (#322)
Browse files Browse the repository at this point in the history
- Description
Deduce SSD vendor name from part number for Virtum

- Motivation and Context
Currently, ssd_generic.py deduce vendor name by smartctl command. For example,

Device Model:     StorFly VSFDM8XC240G-V11-T
"StorFly" is the vendor name. However, for some SSD vendor, smartctl cannot get vendor name. 
For example:
Device Model:     VSFDM8XC240G-V11-T
In such case, vendor name shall be deduced from part number.
  • Loading branch information
Junchao-Mellanox authored Nov 14, 2022
1 parent bbad250 commit 644f8c2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions sonic_platform_base/sonic_ssd/ssd_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def __init__(self, diskdev):

# Known vendor part
if self.model:
model_short = self.model.split()[0]
if model_short in self.vendor_ssd_utility:
self.fetch_vendor_ssd_info(diskdev, model_short)
self.parse_vendor_ssd_info(model_short)
vendor = self._parse_vendor()
if vendor:
self.fetch_vendor_ssd_info(diskdev, vendor)
self.parse_vendor_ssd_info(vendor)
else:
# No handler registered for this disk model
pass
Expand All @@ -72,6 +72,15 @@ def _parse_re(self, pattern, buffer):
res_list = re.findall(pattern, buffer)
return res_list[0] if res_list else NOT_AVAILABLE

def _parse_vendor(self):
model_short = self.model.split()[0]
if model_short in self.vendor_ssd_utility:
return model_short
elif self.model.startswith('VSF'):
return 'Virtium'
else:
return None

def fetch_generic_ssd_info(self, diskdev):
self.ssd_info = self._execute_shell(self.vendor_ssd_utility["Generic"]["utility"].format(diskdev))

Expand Down

0 comments on commit 644f8c2

Please sign in to comment.