Repository navigation
feat(driver): honor --cpu and --memory as the VM's vCPUs and memory - #14
Merged
Merged
Conversation
The gateway forwards a sandbox's standard resource limits as the template's cpu_limit and memory_limit. The driver ignored them and reported both limits unsupported, so every VM got the driver-wide OPENSHELL_VM_DRIVER_VCPUS and OPENSHELL_VM_DRIVER_MEM_MIB whatever was asked for. Now cpu_limit sets the VM's vCPU count and memory_limit its memory, and the driver reports both limits supported. A CPU limit must be a whole number of CPUs (2, 2000m), because a Firecracker VM has whole vCPUs; 1.5 is refused, not rounded. Memory takes a Kubernetes quantity (8Gi, 8192Mi, 8G), rounded down to whole MiB. Requests are bounded by the new OPENSHELL_VM_MAX_VCPUS (at most Firecracker's 32) and the existing OPENSHELL_VM_MAX_MEM_MIB; each defaults to the default size. They are checked at create and again at every launch, as the memory request was before. driver_config.mem_mib is removed in favour of --memory. A driver_config that still sets it is refused with a pointer to --memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clippy's doc_markdown (pedantic, denied in CI) reads mixed-case words such as vCPUs and microVM in doc comments as unquoted code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gateway forwards
sandbox create --cpu/--memoryas the template'scpu_limitandmemory_limit. The driver ignored both and reported them unsupported, so every VM gotOPENSHELL_VM_DRIVER_VCPUS(2) andOPENSHELL_VM_DRIVER_MEM_MIB(2048).cpu_limitsets the VM's vCPU count. It must be a whole number of CPUs (4,4000m);1.5is refused rather than rounded.memory_limitsets its memory, from a Kubernetes quantity (8Gi,8192Mi,8G), rounded down to whole MiB.OPENSHELL_VM_MAX_VCPUS(at most 32) and the existingOPENSHELL_VM_MAX_MEM_MIBbound the requests. Each defaults to the default size, so nothing changes until an operator raises them. The driver checks the requests at create and again at every launch.driver_config.mem_mibis removed. A request that still sets it is refused with a pointer to--memory.install.share updated. The security notes now say that--cpuand--memorydon't needallow_driver_config.Not built or tested locally: the sandbox I worked in didn't have the disk space to compile the driver. CI (
driver:ci: format, clippy-D warnings, tests) is the first build of this change. The code is rustfmt-clean.🤖 Generated with Claude Code