Skip to content

pass VM CPU and RAM spec through OCI annotations#93

Merged
dmcgowan merged 1 commit intocontainerd:mainfrom
akerouanton:vm-resources
Feb 11, 2026
Merged

pass VM CPU and RAM spec through OCI annotations#93
dmcgowan merged 1 commit intocontainerd:mainfrom
akerouanton:vm-resources

Conversation

@akerouanton
Copy link
Member

Add support for two new OCI annotations:

  • io.containerd.nerdbox.resources.cpu: numnber of vCPUs to allocate to the VM.
  • io.containerd.nerdbox.resources.memory: amount of RAM to allocate to the VM, in MiB.

Copilot AI review requested due to automatic review settings February 9, 2026 21:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for configuring VM vCPU count and RAM via OCI annotations and plumbs that configuration into VM creation/startup.

Changes:

  • Introduces io.containerd.nerdbox.resources.cpu and .memory annotations and parses them from the OCI bundle.
  • Adds a VM instance API (SetCPUAndMemory) and wires it into the libkrun implementation.
  • Updates documentation and cross-links to the new VM configuration doc section.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/vm/vm.go Extends the VM Instance interface with a CPU/memory configuration method.
internal/vm/libkrun/instance.go Implements SetCPUAndMemory and removes hardcoded CPU/mem defaults from Start.
internal/shim/task/service.go Adds resource config parsing during bundle load and applies it to the VM before start.
internal/shim/task/resource_config.go New bundle transformer + VM setup logic for CPU/memory annotations.
docs/vm-configuration.md Documents resource annotations and reorganizes networking section under VM configuration.
docs/ctr-networking.md Updates link to point to the new VM configuration networking section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@akerouanton akerouanton force-pushed the vm-resources branch 2 times, most recently from 995c776 to eb488c3 Compare February 9, 2026 22:27
Copilot AI review requested due to automatic review settings February 9, 2026 22:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add support for two new OCI annotations:

- `io.containerd.nerdbox.resources.cpu`: numnber of vCPUs to allocate to
  the VM.
- `io.containerd.nerdbox.resources.memory`: amount of RAM to allocate to
  the VM, in MiB.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
Copy link
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annotations LGTM

I would like to have another pass at the VM instance interface, but we can take this in for now. Mostly I think there is a life cycle issue today, the instance is an instance from the underlying driver perspective but does not represent the state of the VM. Having functions such as setting resources or adding disks which can only be done before/on start is not a great interface. Likely we should move more of these options in the start interface and the only "instance" functions should be usable on a running VM, possibly with type assertion based on what the instance supports. For example, add disk to a running VM would be a good feature, but not necessarily implemented by all backends or necessary for the single container use case.

@dmcgowan dmcgowan merged commit fc3566a into containerd:main Feb 11, 2026
3 checks passed
@akerouanton akerouanton deleted the vm-resources branch February 11, 2026 18:27
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.

2 participants