feat(storage): disks, pools, volumes and drive health without smartctl (NetOrk/netork#2896)

WindowsStorageMixin implements napalm-device-types' HostStorageMixin, so
the host reports its storage and stays a host:

- get_disks: Get-PhysicalDisk with medium, bus, Windows' health and the
  Storage Spaces pool a disk is in; a Storage Spaces virtual disk is no
  physical disk.
- get_disk_smart: Get-StorageReliabilityCounter per disk (temperature,
  wear, power-on hours, uncorrected read and write errors). A counter
  that cannot be read is no counter, not an error; disks that report
  nothing are left out.
- get_disk_pools: Storage Spaces' pools.
- get_volumes: fixed volumes mounted at a drive letter or in a folder,
  with file system and health.

A disk whose medium Windows cannot tell and whose counters are empty (a
virtual disk, a RAID controller's logical disk) reads temperature -1 and
health "unknown". Every script probes its cmdlets first. The fixtures
are synthetic; the scripts are in harvest.py for the first real host.
This commit is contained in:
Christian Manivong committed 2026-12-01 12:50:56 +01:00
1 parent 977ddbd904
commit 7a5c607ae4
10 files changed
+934 -2

No files matched your search

+4 -1
View File
@@ -14,7 +14,7 @@ import argparse
import getpass
import pathlib
from napalm_windows import WindowsDriver, scheduled_tasks, time_sync
from napalm_windows import WindowsDriver, scheduled_tasks, storage, time_sync
from napalm_windows import windows as mod
SCRIPTS = {
@@ -27,6 +27,9 @@ SCRIPTS = {
"listening": mod._PS_LISTENING,
"scheduled_tasks": scheduled_tasks._PS_SCHEDULED_TASKS,
"time_sync": time_sync._PS_TIME_SYNC,
"disks": storage._PS_DISKS,
"storage_pools": storage._PS_STORAGE_POOLS,
"volumes": storage._PS_VOLUMES,
}
OUT = pathlib.Path(__file__).parent / "harvest-out"