Skip to content

SR view: list the host's SRs even when no VM uses them (#6) - #15

Merged
olivierlambert merged 1 commit into
mainfrom
fix/idle-srs
Oct 2, 2026
Merged

olivierlambert merged 1 commit into
mainfrom
fix/idle-srs

Conversation

@olivierlambert

Copy link
Copy Markdown
Owner

Fixes #6: with no running VM, the SR view showed "no storage mapping (xenstore)", and an SR only appeared while a VM used it. Rows were built from active VM disks only.

Changes

  • xapi: on each refresh (every 3 min, and at first connection), read the SRs plugged into this host: host UUID from /etc/xensource-inventory, then host → PBDs → SRs. DVD drives and removable media (udev) and ISO libraries (content_type: iso) are left out. Bounded, sanitised, on the worker thread like the other lookups.
  • model: Snapshot.host_srs; compute() gives each a row, idle (0 VBDs, 0 IOPS) when no disk is active on it, with xapi's exact type.
  • ui: an empty SR view says "no VM disks active on this host", and "no storage mapping (xenstore)" only when the mapping itself is missing.
  • CHANGELOG: this, plus the --lib fix from source: one module for loading the Xen libraries #10 under Security.

Testing

  • 3 new tests: host SRs from a fake xapi (attached / unplugged / udev / ISO / bad UUID), INSTALLATION_UUID parsing, idle rows in compute(). 81 tests, clippy, fmt pass.
  • On an XCP-ng 8.3 host (--batch): of its 6 SRs, only "Local storage" (ext) is listed; "Removable storage", "DVD drives" and 3 ISO SRs are left out, matching xe sr-list / xe pbd-list. Its only SR is in use there, so the idle case itself is covered by the unit tests.

Newly plugged SRs show up within the 3-minute name refresh.

🤖 Generated with Claude Code

Issue #6: on a host with no running VM, the SR view said "no storage
mapping (xenstore)", and an SR only appeared while a VM had a disk on
it. The rows were built from active VBDs alone.

- xapi: on each refresh, read this host's plugged SRs (host UUID from
  xensource-inventory, then host -> PBDs -> SRs), leaving out udev
  (DVD drives, removable media) and ISO libraries. Bounded, sanitised
  and on the worker thread like the other lookups.
- model: Snapshot.host_srs; compute() gives each one a row, idle when
  no disk is active on it, and takes xapi's exact type.
- ui: without rows, say "no VM disks active on this host" unless the
  storage mapping itself is missing.
- CHANGELOG: this, and the --lib fix from #10 under Security.

Tested on an XCP-ng 8.3 host: of its six SRs only "Local storage"
(ext) is listed; removable storage, DVD drives and three ISO SRs are
left out. Its only SR is in use there, so the idle case is covered by
the new unit tests (fake xapi, model).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@olivierlambert
olivierlambert merged commit 1ff3005 into main Oct 2, 2026
5 checks passed
@olivierlambert
olivierlambert deleted the fix/idle-srs branch October 2, 2026 16:26
@olivierlambert olivierlambert mentioned this pull request Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"no storage mapping (xenstore)" in "disk" section of xentop-ng

1 participant