get_disks reports a failed lsblk as "no disks" and hides smartctl errors #16

Closed
opened 2026-11-01 21:44:46 +00:00 by christianmanivong · 0 comments
Owner

What happens

get_disks (napalm_openmediavault/openmediavault.py 157-263):

  • If lsblk -J … fails or prints something that is not JSON, the exception is swallowed and the empty list is returned (lines 195-201):
    lsblk = _json.loads(raw)
    except Exception:
        return result
    
    [] is also the answer for a NAS without disks, so the caller cannot tell a failed read from an empty one, against the rule that a failed read raises.
  • Every smartctl failure (sudo refused, timeout) is caught and logged at debug level (line 246), and the disk is reported with health: "unknown", temperature: -1 — indistinguishable from a disk that has no SMART.
  • _disk_to_pool swallows a failed /proc/mdstat read the same way.

The contract allows health "healthy", "warning", "failed", "unknown" (napalm_device_types/models.py:907); this driver never reports "warning" (for example reallocated/pending sectors with an overall PASSED). The verdict itself is never found because -iA does not print it — that part is #4.

Expected

  • A failed lsblk raises.
  • A failed smartctl call is distinguishable (logged as a warning, or reported per disk), not folded into "unknown".
  • Once #4 reads the verdict, attributes such as Reallocated_Sector_Ct / Current_Pending_Sector > 0 map to "warning".

Test-first: lsblk output sudo: … raises; a smartctl timeout is logged at warning level.

Priority: P3 — disks vanish from netOrk's view on a transient error, and degraded disks are never flagged.

Found during the bug sweep of 2026-11-01.

## What happens `get_disks` (`napalm_openmediavault/openmediavault.py` 157-263): - If `lsblk -J …` fails or prints something that is not JSON, the exception is swallowed and the empty list is returned (lines 195-201): ```python lsblk = _json.loads(raw) except Exception: return result ``` `[]` is also the answer for a NAS without disks, so the caller cannot tell a failed read from an empty one, against the rule that a failed read raises. - Every `smartctl` failure (sudo refused, timeout) is caught and logged at debug level (line 246), and the disk is reported with `health: "unknown"`, `temperature: -1` — indistinguishable from a disk that has no SMART. - `_disk_to_pool` swallows a failed `/proc/mdstat` read the same way. The contract allows `health` `"healthy"`, `"warning"`, `"failed"`, `"unknown"` (`napalm_device_types/models.py:907`); this driver never reports `"warning"` (for example reallocated/pending sectors with an overall PASSED). The verdict itself is never found because `-iA` does not print it — that part is #4. ## Expected - A failed `lsblk` raises. - A failed `smartctl` call is distinguishable (logged as a warning, or reported per disk), not folded into "unknown". - Once #4 reads the verdict, attributes such as Reallocated_Sector_Ct / Current_Pending_Sector > 0 map to `"warning"`. Test-first: `lsblk` output `sudo: …` raises; a `smartctl` timeout is logged at warning level. Priority: P3 — disks vanish from netOrk's view on a transient error, and degraded disks are never flagged. Found during the bug sweep of 2026-11-01.
christianmanivong added the
prio
P3
bug
labels 2026-11-01 21:44:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-openmediavault#16