Skip to content

Commit

Permalink
[ssd_generic] Fix innodisk health regex (sonic-net#287)
Browse files Browse the repository at this point in the history
Description
The heath metric in ssd_generic for innodisk SSDs is too lazy. Fix to match the entire health number rather than just the first digit.

How Has This Been Tested?
Manual testing on Mellanox MSN2100
  • Loading branch information
alexrallen authored Jun 1, 2022
1 parent f575a40 commit 04b08ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_ssd/ssd_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def parse_generic_ssd_info(self):

def parse_innodisk_info(self):
if self.vendor_ssd_info:
self.health = self._parse_re('Health:\s*(.+?)%?', self.vendor_ssd_info)
self.health = self._parse_re('Health:\s*(.+?)%', self.vendor_ssd_info)
self.temperature = self._parse_re('Temperature\s*\[\s*(.+?)\]', self.vendor_ssd_info)
else:
if self.health == NOT_AVAILABLE:
Expand Down
4 changes: 2 additions & 2 deletions tests/ssd_generic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
Model Name: InnoDisk Corp. - mSATA 3ME
FW Version: S140714
Serial Number: 20171126AAAA11730156
Health: 0.00
Health: 82.34%
Capacity: 29.818199 GB
P/E Cycle: 3000
Lifespan : 0 (Years : 0 Months : 0 Days : 0)
Expand Down Expand Up @@ -397,7 +397,7 @@ def test_Innodisk_ssd(self):

Innodisk_ssd.vendor_ssd_info = output_Innodisk_vendor_info
Innodisk_ssd.parse_vendor_ssd_info('InnoDisk')
assert(Innodisk_ssd.get_health() == '0')
assert(Innodisk_ssd.get_health() == '82.34')
assert(Innodisk_ssd.get_model() == 'InnoDisk Corp. - mSATA 3ME')
assert(Innodisk_ssd.get_firmware() == "S140714")
assert(Innodisk_ssd.get_temperature() == '0')
Expand Down

0 comments on commit 04b08ba

Please sign in to comment.