Skip to content

fix(cloud-hypervisor): pass block devices in a single --disk flag - #990

Open
CapThunder19 wants to merge 1 commit into
urunc-dev:mainfrom
CapThunder19:fix/ch-single-disk-flag
Open

CapThunder19 wants to merge 1 commit into
urunc-dev:mainfrom
CapThunder19:fix/ch-single-disk-flag

Conversation

@CapThunder19

@CapThunder19 CapThunder19 commented Aug 24, 2026 •

Copy link
Copy Markdown

Description

CloudHypervisor.BuildExecCmd appended a separate --disk flag per block
device. Cloud Hypervisor only accepts one --disk flag with every disk as a
value after it and rejects a repeated flag:

error: the argument '--disk <disk>...' cannot be used multiple times

So any container with more than one block device (e.g. block rootfs + a
block-backed volume) failed to start. A single disk worked, which is why the
existing e2e cases (all single-disk) missed it.

Fix: collect the disk specs and emit them behind one --disk.

# before
--disk path=/rootfs.img,id=rootfs --disk path=/dev/loop0,id=vol0

# after
--disk path=/rootfs.img,id=rootfs path=/dev/loop0,id=vol0

ExactArgs and the no-block-device case are unaffected.

Related issues

How was this tested?

Reproduced end-to-end with urunc + cloud-hypervisor v50.0.0
using a hand-built OCI bundle with a block rootfs and one
loop-backed volume no containerd/devmapper needed. Before the fix,
cloud-hypervisor rejects the args; after, it proceeds to kernel loading.

Also ran go build ./..., go vet, gofmt, and the existing
./pkg/unikontainers/... unit tests all pass

LLM usage

Claude sonnet investigating the bug and fixes

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint) no new issues from this change.
  • 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.

@netlify

netlify Bot commented Aug 24, 2026

Copy link
Copy Markdown

✅ Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 059b4b2
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a8c4af54651af00089d7539

@CapThunder19

Copy link
Copy Markdown
Author

pls review it and tell me if any change needed

@Anand-240

Copy link
Copy Markdown
Contributor

I was going through this PR and the change looks correct to me. On main the block loop adds a --disk for every device, so once there's more than one disk you get multiple --disk flags and cloud-hypervisor just refuses to start. Collecting them under a single --disk is the right fix.
While I was in that folder I noticed cloud-hypervisor doesn't have a test file yet. qemu and hyperlight both have one, so I followed that same pattern.
So I tried writing a small regression test for BuildExecCmd that checks multiple block devices end up under exactly one --disk flag. It fails on main (two flags) and passes with your change, and gofmt and go vet are both clean.
If it's useful, I can send it over. Do you want me to open a PR against your fix/ch-single-disk-flag branch so the fix and the test land together, or should I add it as a follow-up once this merges? Either works for me.

@cmainas cmainas added invalid This doesn't seem right do-not-merge labels Aug 26, 2026
@CapThunder19

Copy link
Copy Markdown
Author

@cmainas why invalid, what changes need to make?

@cmainas

cmainas commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Hello @CapThunder19 ,

please read the contribution guide.

Specifically:

  • the PR template has been changed and this is not allowed.
  • No LLM disclosure

@CapThunder19

Copy link
Copy Markdown
Author

@cmainas i have updated the pr description pls check

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloud-hypervisor: container with more than one block device fails to start (repeated --disk flags)

3 participants