truenas / py-SMART

Wrapper for smartctl (smartmontools)
GNU Lesser General Public License v2.1
79 stars 35 forks source link

pySMART fails to create Device for nvme drives #75

Closed NicholasCJL closed 1 year ago

NicholasCJL commented 1 year ago

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 '- -':

https://github.com/truenas/py-SMART/blob/1c7d32c2363d20a91d6cf5d5ec0261fee25e8531/pySMART/interface/nvme/__init__.py#L740-L742

Environmental setup:

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.