Skip to content

Commit f5622df

Browse files
authored
Merge branch 'sonic-net:master' into Revise_get_firmware_update_notification_output_to_string
2 parents f6e1169 + 51c6207 commit f5622df

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

sonic_platform_base/sonic_storage/ssd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ def parse_innodisk_info(self):
240240

241241
def parse_virtium_info(self):
242242
if self.vendor_ssd_info:
243-
self.temperature = self._parse_re('Temperature_Celsius\s*\d*\s*(\d+?)\s+', self.vendor_ssd_info)
243+
vendor_temp = self._parse_re('Temperature_Celsius\s*\d*\s*(\d+?)\s+', self.vendor_ssd_info)
244+
if vendor_temp != NOT_AVAILABLE:
245+
self.temperature = vendor_temp
244246
nand_endurance = self._parse_re('NAND_Endurance\s*\d*\s*(\d+?)\s+', self.vendor_ssd_info)
245247
avg_erase_count = self._parse_re('Average_Erase_Count\s*\d*\s*(\d+?)\s+', self.vendor_ssd_info)
246248
if nand_endurance != NOT_AVAILABLE and avg_erase_count != NOT_AVAILABLE:

tests/test_ssd.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,65 @@
11291129
If Selective self-test is pending on power-up, resume after 0 minute delay.
11301130
"""
11311131

1132+
output_vitrium_nvme_generic = """
1133+
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.1.0-11-2-amd64] (local build)
1134+
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
1135+
=== START OF INFORMATION SECTION ===
1136+
Model Number: Virtium VTPM24CEXI080-BM110006
1137+
Serial Number: 64008-0094
1138+
Firmware Version: CE00A400
1139+
PCI Vendor/Subsystem ID: 0x1f9f
1140+
IEEE OUI Identifier: 0x00e04c
1141+
Controller ID: 1
1142+
NVMe Version: 1.4
1143+
Number of Namespaces: 1
1144+
Namespace 1 Size/Capacity: 80,026,361,856 [80.0 GB]
1145+
Namespace 1 Formatted LBA Size: 512
1146+
Namespace 1 IEEE EUI-64: 00e04c 00a6105150
1147+
Local Time is: Fri May 31 09:42:45 2024 IDT
1148+
Firmware Updates (0x02): 1 Slot
1149+
Optional Admin Commands (0x0017): Security Format Frmw_DL Self_Test
1150+
Optional NVM Commands (0x005e): Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
1151+
Log Page Attributes (0x02): Cmd_Eff_Lg
1152+
Maximum Data Transfer Size: 32 Pages
1153+
Warning Comp. Temp. Threshold: 100 Celsius
1154+
Critical Comp. Temp. Threshold: 110 Celsius
1155+
Supported Power States
1156+
St Op Max Active Idle RL RT WL WT Ent_Lat Ex_Lat
1157+
0 + 8.00W - - 0 0 0 0 230000 50000
1158+
1 + 4.00W - - 1 1 1 1 4000 50000
1159+
2 + 3.00W - - 2 2 2 2 4000 250000
1160+
3 - 0.0300W - - 3 3 3 3 5000 10000
1161+
4 - 0.0050W - - 4 4 4 4 20000 45000
1162+
Supported LBA Sizes (NSID 0x1)
1163+
Id Fmt Data Metadt Rel_Perf
1164+
0 + 512 0 0
1165+
=== START OF SMART DATA SECTION ===
1166+
SMART overall-health self-assessment test result: PASSED
1167+
SMART/Health Information (NVMe Log 0x02)
1168+
Critical Warning: 0x00
1169+
Temperature: 53 Celsius
1170+
Available Spare: 100%
1171+
Available Spare Threshold: 32%
1172+
Percentage Used: 0%
1173+
Data Units Read: 253,310 [129 GB]
1174+
Data Units Written: 598,492 [306 GB]
1175+
Host Read Commands: 3,015,892
1176+
Host Write Commands: 5,589,998
1177+
Controller Busy Time: 0
1178+
Power Cycles: 79
1179+
Power On Hours: 265
1180+
Unsafe Shutdowns: 77
1181+
Media and Data Integrity Errors: 0
1182+
Error Information Log Entries: 0
1183+
Warning Comp. Temperature Time: 0
1184+
Critical Comp. Temperature Time: 0
1185+
"""
1186+
1187+
output_smartcmd_vitrium_error = """
1188+
[Error] Cannot read SMART information on device /dev/nvme0n1
1189+
"""
1190+
11321191
class TestSsd:
11331192
@mock.patch('sonic_platform_base.sonic_storage.ssd.SsdUtil._execute_shell', mock.MagicMock(return_value=output_nvme_ssd))
11341193
def test_nvme_ssd(self):
@@ -1338,3 +1397,9 @@ def test_intel_ssd(self):
13381397
assert(intel_ssd.get_disk_io_reads() == '18922')
13391398
assert(intel_ssd.get_disk_io_writes() == '44554')
13401399
assert(intel_ssd.get_reserved_blocks() == '0')
1400+
1401+
@mock.patch('sonic_platform_base.sonic_storage.ssd.SsdUtil._execute_shell')
1402+
def test_temperature_virtrium_nvme(self, mock_exec):
1403+
mock_exec.side_effect = [output_vitrium_nvme_generic, output_smartcmd_vitrium_error]
1404+
vitrium_ssd = SsdUtil('/dev/nvme0n1')
1405+
assert vitrium_ssd.get_temperature() == 53.0

0 commit comments

Comments
 (0)