Skip to content

fix(hypervisors): prevent double --initramfs flag in Cloud Hypervisor command#680

Open
mdryaan wants to merge 1 commit into
urunc-dev:mainfrom
mdryaan:fix/cloud-hypervisor-double-initrd
Open

fix(hypervisors): prevent double --initramfs flag in Cloud Hypervisor command#680
mdryaan wants to merge 1 commit into
urunc-dev:mainfrom
mdryaan:fix/cloud-hypervisor-double-initrd

Conversation

@mdryaan
Copy link
Copy Markdown

@mdryaan mdryaan commented May 14, 2026

Description

BuildExecCmd in cloud_hypervisor.go appended --initramfs unconditionally for both args.InitrdPath and extraMonArgs.ExtraInitrd. When both were set, the Cloud Hypervisor command line contained two --initramfs flags and Cloud Hypervisor rejected it. Apply the same priority-fallback logic already used by the Firecracker implementation: resolve to args.InitrdPath if set, otherwise fall back to extraMonArgs.ExtraInitrd, and append at most one --initramfs.

Related issues

How was this tested?

Added TestCloudHypervisorSingleInitrd to pkg/unikontainers/hypervisors/cloud_hypervisor_test.go. The test calls BuildExecCmd with both args.InitrdPath and a mock unikernel returning a non-empty ExtraInitrd, then counts --initramfs occurrences in the result.

Before fix:

Screenshot 2026-05-14 091623

After fix:

Screenshot 2026-05-14 091934

Run with:
go test ./pkg/unikontainers/hypervisors/ -v -run TestCloudHypervisorSingleInitrd

golangci-lint run passes with 0 issues. make builds successfully.

LLM usage

N/A

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.

… command

Signed-off-by: mdryaan <alikhurshid842001@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 14, 2026

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 777e38e
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a05485391838d0008856ba3

@mdryaan
Copy link
Copy Markdown
Author

mdryaan commented May 14, 2026

Hey @cmainas , Could you please have a look at this PR whenever you have time? Thanks!

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.

Cloud Hypervisor BuildExecCmd should not add two --initramfs flags

1 participant