Skip to content

fix: use annotation for MirageOS block device name#753

Open
pocopepe wants to merge 2 commits into
urunc-dev:mainfrom
pocopepe:fix/315-mirage-block-annotation
Open

fix: use annotation for MirageOS block device name#753
pocopepe wants to merge 2 commits into
urunc-dev:mainfrom
pocopepe:fix/315-mirage-block-annotation

Conversation

@pocopepe

@pocopepe pocopepe commented Jun 8, 2026

Copy link
Copy Markdown

Description

MirageOS unikernels declare their block device names at build time through the Solo5 manifest. urunc was hardcoding "storage" as the block device ID, so if a unikernel declared a different name it would fail at runtime with Resource not declared in manifest.
Added a new annotation com.urunc.unikernel.blkDev so image builders can set the block device name at build time. Falls back to "storage" when the annotation is absent so existing images keep working.

Same approach as #690 for net device naming. Task 2 of 3 from #315.

Related issues

How was this tested?

go test ./pkg/unikontainers/unikernels/... -v -run TestMirageSolo5BlkDevName

=== RUN   TestMirageSolo5BlkDevName
=== RUN   TestMirageSolo5BlkDevName/uses_block_device_name_from_annotation
=== PAUSE TestMirageSolo5BlkDevName/uses_block_device_name_from_annotation
=== RUN   TestMirageSolo5BlkDevName/falls_back_to_storage_when_annotation_is_absent
=== PAUSE TestMirageSolo5BlkDevName/falls_back_to_storage_when_annotation_is_absent
=== CONT  TestMirageSolo5BlkDevName/uses_block_device_name_from_annotation
=== CONT  TestMirageSolo5BlkDevName/falls_back_to_storage_when_annotation_is_absent
--- PASS: TestMirageSolo5BlkDevName (0.00s)
    --- PASS: TestMirageSolo5BlkDevName/uses_block_device_name_from_annotation (0.00s)
    --- PASS: TestMirageSolo5BlkDevName/falls_back_to_storage_when_annotation_is_absent (0.00s)
PASS
ok      github.com/urunc-dev/urunc/pkg/unikontainers/unikernels

With annotation (com.urunc.unikernel.blkDev=storage, matches kernel manifest):

$ sudo nerdctl run --rm --runtime io.containerd.urunc.v2 --snapshotter devmapper --network=none blkdev:fix
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.urunc.v2"
            |      ___|
  __|  _ \  |  _ \ __ \
\__ \ (   | | (   |  ) |
____/\___/ _|\___/____/
Solo5: Bindings version v0.9.0
...
2026-06-08T09:57:41-00:00: [INFO] [block] Total tests started: 10
2026-06-08T09:57:41-00:00: [INFO] [block] Total tests passed:  10
2026-06-08T09:57:41-00:00: [INFO] [block] Total tests failed:  0
Solo5: solo5_exit(0) called

solo5 accepts --block:storage=... and boots.

With wrong annotation (com.urunc.unikernel.blkDev=blkdata, mismatches manifest):

$ sudo nerdctl run --rm --runtime io.containerd.urunc.v2 --snapshotter devmapper --network=none blkdev:bug
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.urunc.v2"
solo5-hvt: Resource not declared in manifest: 'blkdata'
solo5-hvt: Resource not declared in manifest: 'blkdata'
solo5-hvt: Invalid option: `--block:blkdata=/.boot/rootfs'

urunc passes the annotation value directly to solo5, solo5 rejects since the manifest only declares storage.

Without annotation (falls back to storage):

$ sudo nerdctl run --rm --runtime io.containerd.urunc.v2 --snapshotter devmapper --network=none block-test-hvt-mirage:latest
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.urunc.v2"
...
2026-06-08T09:57:53-00:00: [INFO] [block] Total tests passed:  10
Solo5: solo5_exit(0) called

existing images without the annotation fall back to storage and keep working.

Pushed images:

LLM usage

Claude Sonnet 4.6

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

pocopepe added 2 commits June 8, 2026 15:33
Related: urunc-dev#315
Signed-off-by: viju <avijusanjai@gmail.com>
Ref: urunc-dev#315
Signed-off-by: viju <avijusanjai@gmail.com>
@netlify

netlify Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit b5ac803
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a26976a8838da0009b42e8b

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