feat: report how full /, /boot and /var are in the host status #28

Merged
christianmanivong merged 1 commits from fix/volume-almost-full-862 into main 2026-10-11 08:33:04 +00:00
Owner

For NetOrk/netork#862: netOrk has a volume_almost_full warning, but nothing ever raised it. pve-dual's root filesystem sat at 94 % (about 400 MB free) for a week, until a kernel upgrade failed with "No space left on device" and left dpkg halfway.

Change

  • HOST_STATUS_COMMAND gains a [filesystems] section that runs POSIX df -Pk / /boot /var. It needs no root.
  • parse_host_status returns filesystems: a list of {mountpoint, total, used, available} in bytes, one entry per filesystem. A directory that is not its own mount appears under the filesystem it lives on. If df printed nothing usable, the value is None.
  • models.py: new FilesystemUsageDict, and HostStatusDict.filesystems (NotRequired).
  • Version 4.4.0.

No driver needs a change. Linux, Proxmox, BSD and OpenMediaVault already run HOST_STATUS_COMMAND through their shell transport. The threshold is decided in netOrk, not here.

Verification

  • tests/test_host_status.py: new class TestFilesystems with 9 tests. One of them runs the real command through sh.
  • The full test suite passed (498).
  • napalm-linux, napalm-proxmox and napalm-bsd tests are green against this base.
For NetOrk/netork#862: netOrk has a `volume_almost_full` warning, but nothing ever raised it. pve-dual's root filesystem sat at 94 % (about 400 MB free) for a week, until a kernel upgrade failed with "No space left on device" and left dpkg halfway. ## Change - `HOST_STATUS_COMMAND` gains a `[filesystems]` section that runs POSIX `df -Pk / /boot /var`. It needs no root. - `parse_host_status` returns `filesystems`: a list of `{mountpoint, total, used, available}` in bytes, one entry per filesystem. A directory that is not its own mount appears under the filesystem it lives on. If df printed nothing usable, the value is `None`. - `models.py`: new `FilesystemUsageDict`, and `HostStatusDict.filesystems` (NotRequired). - Version 4.4.0. No driver needs a change. Linux, Proxmox, BSD and OpenMediaVault already run `HOST_STATUS_COMMAND` through their shell transport. The threshold is decided in netOrk, not here. ## Verification - `tests/test_host_status.py`: new class `TestFilesystems` with 9 tests. One of them runs the real command through `sh`. - The full test suite passed (498). - napalm-linux, napalm-proxmox and napalm-bsd tests are green against this base.
christianmanivong added 1 commit 2026-10-11 07:06:09 +00:00
feat: report how full /, /boot and /var are in the host status
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 23s
CI / test (3.10) (pull_request) Successful in 23s
CI / test (3.11) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 25s
c947250179
A Proxmox host's root filesystem stood at 94 % with about 400 MB free for a
week; a kernel upgrade failed on it with "No space left on device" and left
dpkg halfway, and nothing had said the disk was full (NetOrk/netork#862).

HOST_STATUS_COMMAND now also runs POSIX `df -Pk / /boot /var`, without root.
get_host_status() returns `filesystems`: each filesystem once (a directory
that is not a mount of its own is the filesystem it lives on), with its
mountpoint, total, used and available bytes, or None when df said nothing.
`available` is what df says an ordinary user can still write, which on ext4
is less than total minus used. How full is too full is the caller's decision.

Version 4.4.0.
christianmanivong merged commit a710a85de6 into main 2026-10-11 08:33:04 +00:00
Sign in to join this conversation.