truenas / py-SMART

Wrapper for smartctl (smartmontools)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pySMART fails to create Device for nvme drives

NicholasCJL opened this issue · comments

Describe the bug
pySMART fails to create Device if device is nvme when using the latest version of smartmontools (release 7.4).

Raw outputs
smartctl -d nvme --all <device> works fine to retrieve information about the device, but the new smartmontools release changes the output format of the self-test log causing the regex in pySMART to return an unexpected value.

The following code then behaves unexpectedly as it expects '-' while the greedy regex match returns '- -':

failingLBA = None
if match.group(5) != '-':
failingLBA = int(match.group(5))

Environmental setup:

  • Complete smartctl version [smartctl 7.4 2023-08-01 r5530 [x86_64-w64-mingw32-w11-22H2] (sf-7.4-1)]
  • Py-SMART version [e.g. v1.2.0]

Additional context
The old smartmontools output is given by:

if (++cnt == 1)
      pout("Num  Test_Description  Status                       Power_on_Hours  Failing_LBA  NSID SCT Code\n");

while the new output is:

    if (++cnt == 1)
      jout("Num  Test_Description  Status                       Power_on_Hours  Failing_LBA  NSID Seg SCT Code\n");

There is an additional column Seg in the new output, which the pySMART code does not expect.