Skip to content

fix(storage): read SM's sm-data for any backend kind, not only vbd3 - #21

Open
gounthar wants to merge 1 commit into
olivierlambert:mainfrom
gounthar:fix/sm-data-any-backend
Open

gounthar wants to merge 1 commit into
olivierlambert:mainfrom
gounthar:fix/sm-data-any-backend

Conversation

@gounthar

@gounthar gounthar commented Oct 10, 2026 •

Copy link
Copy Markdown

On the RISC-V XCP-ng dom0 we're bringing up, the file SR serves VDIs through a loop device and blkback, not tapdisk. The VBD lives under backend/vbd, params is /dev/loop0, and SM publishes vdi-uuid and mem-pool under sm-data, the same keys it writes for vbd3. The sm-data fallback in StorageMap only ran for VbdKind::Vbd3, so the guest disk ended up under an SR called /dev and the real SR showed no VBDs.

This drops the vbd3 condition. The path stays: when mem-pool is there, Backing::group() picks the SR, and when it isn't, the disk groups by directory as before and only gains the VDI. If you'd rather keep the fallback narrower (blkback with a /dev/... params only, say), I can change it.

On the dom0, with mem-pool present on the VBD node:

binary xvda SR / VDI SR Disk VBDs
0.5.0 none, under /dev 0
this branch Disk / trixie-root 1

Without mem-pool it stays under /dev with the VDI filled in. 101/101 tests pass on x86_64 and on a native riscv64 build, clippy and fmt clean. I haven't run it on a plain Xen host; there's no sm-data there, so the extra read should return nothing.

The rawfile driver on our side now writes mem-pool too (baptleduc/hypervisor-dev#11).

This work was assisted by an LLM.

An SM driver that attaches a block device and asks for blkback leaves
params as the device ("/dev/loop0") and publishes vdi-uuid and
mem-pool under backend/vbd/<dom>/<dev>/sm-data, the same keys SM writes
for vbd3. The fallback only looked there for vbd3, so such a disk was
grouped under an SR named "/dev" and its real SR showed no VBDs.

Seen on a RISC-V XCP-ng dom0 whose file SR serves VDIs through loop
devices and blkback. Plain Xen hosts have no sm-data, so the extra
read returns nothing there and the backing stays the path.

The path is kept: once mem-pool names the SR, Backing::group() uses
the SR; without mem-pool the disk still groups by its directory, as
before, and only gains the VDI.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
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.

1 participant