Skip to content

Commit

Permalink
Merge pull request #63 from rhoriguchi/nvme
Browse files Browse the repository at this point in the history
Fix some parsing issues with nvme values
  • Loading branch information
ralequi authored Mar 24, 2023
2 parents 3a94703 + ee00854 commit aebb2b5
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 6 deletions.
10 changes: 5 additions & 5 deletions pySMART/interface/nvme.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,21 +524,21 @@ def parse(self, data: Iterator[str]) -> None:
elif name == 'Data Units Read':
# Format: 1,234,567 [2.00 TB]
self.dataUnitsRead = int(
value.split(' ')[0].replace(',', '').replace('.', ''))
value.split(' ')[0].replace(',', '').replace('.', '').replace('’', ''))
self.bytesRead = humanfriendly.parse_size(
value.split(' ', 1)[1][1:-1].replace(',', '.'))
elif name == 'Data Units Written':
# Format: 1,234,567 [2.00 TB]
self.dataUnitsWritten = int(
value.split(' ')[0].replace(',', '').replace('.', ''))
value.split(' ')[0].replace(',', '').replace('.', '').replace('’', ''))
self.bytesWritten = humanfriendly.parse_size(
value.split(' ', 1)[1][1:-1].replace(',', '.'))
elif name == 'Host Read Commands':
self.hostReadCommands = int(
value.replace(',', '').replace('.', ''))
value.replace(',', '').replace('.', '').replace('’', ''))
elif name == 'Host Write Commands':
self.hostWriteCommands = int(
value.replace(',', '').replace('.', ''))
value.replace(',', '').replace('.', '').replace('’', ''))
elif name == 'Controller Busy Time':
self.controllerBusyTime = int(
value.replace(',', '').replace('.', ''))
Expand All @@ -547,7 +547,7 @@ def parse(self, data: Iterator[str]) -> None:
value.replace(',', '').replace('.', ''))
elif name == 'Power On Hours':
self.powerOnHours = int(
value.replace(',', '').replace('.', ''))
value.replace(',', '').replace('.', '').replace('’', ''))
elif name == 'Unsafe Shutdowns':
self.unsafeShutdowns = int(
value.replace(',', '').replace('.', ''))
Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/listingtests/linux_01/_--scan-open
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/dev/nvme0 -d nvme # /dev/nvme0, NVMe device
/dev/nvme0 -d nvme # /dev/nvme0, NVMe device
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-5.15.103] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number: WDS200T1X0E-00AFY0
Serial Number: XXXXXXXXXXXX
Firmware Version: 614600WD
PCI Vendor/Subsystem ID: 0x15b7
IEEE OUI Identifier: 0x001b44
Total NVM Capacity: 2’000’398’934’016 [2.00 TB]
Unallocated NVM Capacity: 0
Controller ID: 8224
NVMe Version: 1.4
Number of Namespaces: 1
Namespace 1 Size/Capacity: 2’000’398’934’016 [2.00 TB]
Namespace 1 Formatted LBA Size: 512
Namespace 1 IEEE EUI-64: 001b44 8b451ffb99
Local Time is: Thu Mar 23 21:15:53 2023 CET
Firmware Updates (0x14): 2 Slots, no Reset required
Optional Admin Commands (0x0017): Security Format Frmw_DL Self_Test
Optional NVM Commands (0x005f): Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Log Page Attributes (0x1e): Cmd_Eff_Lg Ext_Get_Lg Telmtry_Lg Pers_Ev_Lg
Maximum Data Transfer Size: 128 Pages
Warning Comp. Temp. Threshold: 84 Celsius
Critical Comp. Temp. Threshold: 88 Celsius
Namespace 1 Features (0x02): NA_Fields

Supported Power States
St Op Max Active Idle RL RT WL WT Ent_Lat Ex_Lat
0 + 9.00W 9.00W - 0 0 0 0 0 0
1 + 4.10W 4.10W - 0 0 0 0 0 0
2 + 3.50W 3.50W - 0 0 0 0 0 0
3 - 0.0250W - - 3 3 3 3 5000 10000
4 - 0.0050W - - 4 4 4 4 3900 45700

Supported LBA Sizes (NSID 0x1)
Id Fmt Data Metadt Rel_Perf
0 + 512 0 2
1 - 4096 0 1

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning: 0x00
Temperature: 44 Celsius
Available Spare: 100%
Available Spare Threshold: 10%
Percentage Used: 0%
Data Units Read: 24’646’582 [12.6 TB]
Data Units Written: 19’487’218 [9.97 TB]
Host Read Commands: 243’374’162
Host Write Commands: 696’541’267
Controller Busy Time: 403
Power Cycles: 25
Power On Hours: 3’457
Unsafe Shutdowns: 10
Media and Data Integrity Errors: 0
Error Information Log Entries: 0
Warning Comp. Temperature Time: 0
Critical Comp. Temperature Time: 0

Error Information (NVMe Log 0x01, 16 of 256 entries)
No Errors Logged
Loading

0 comments on commit aebb2b5

Please sign in to comment.