Add KVM device passthrough support for hardware virtualization#13618
Merged
tofarr merged 2 commits intoOpenHands:mainfrom Apr 6, 2026
Merged
Add KVM device passthrough support for hardware virtualization#13618tofarr merged 2 commits intoOpenHands:mainfrom
tofarr merged 2 commits intoOpenHands:mainfrom
Conversation
Contributor
|
I have the same need for KVM passthrough and created a PR as well but mine was based on a more generic docker option passthrough that V0 conversations supported: #13350 |
…lization Add SANDBOX_KVM_ENABLED environment variable to enable passing /dev/kvm to sandbox containers. When enabled, sandboxes can run KVM-accelerated virtual machines instead of using slower emulation. This is useful for workloads that need to spin up VMs inside the sandbox, such as testing operating systems or running nested virtualization. Co-authored-by: openhands <openhands@all-hands.dev>
127e4ab to
3971771
Compare
aivong-openhands
pushed a commit
to aivong-openhands/OpenHands
that referenced
this pull request
Apr 15, 2026
…ands#13618) Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Tim O'Farrell <tofarr@gmail.com>
devin-ai-integration Bot
pushed a commit
to OrpingtonClose/OpenHands
that referenced
this pull request
Apr 26, 2026
…ands#13618) Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Tim O'Farrell <tofarr@gmail.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.
Summary of PR
This PR adds support for passing through
/dev/kvmto sandbox containers, enabling KVM-accelerated virtual machines inside sandboxes instead of slower emulation.Add SANDBOX_KVM_ENABLED environment variable to enable passing /dev/kvm to sandbox containers. When enabled, sandboxes can run KVM-accelerated virtual machines instead of using slower emulation.
This is useful for workloads that need to spin up VMs inside the sandbox, such as testing operating systems or running nested virtualization.
Further work
If there is interest from the community, I could polish the feature. One things that comes to mind is to only enable it for specific sandboxes, by having a checkbox somewhere when launching one.
Demo Screenshots/Videos
Not really a screenshot, but still prooves it works. This was executed inside a sandbox:
openhands@721d061d484b:/workspace/project$ ls -la /dev/kvm crw-rw-rw- 1 nobody nogroup 10, 232 Mar 25 22:30 /dev/kvm openhands@721d061d484b:/workspace/project$ qemu-system-x86_64 -accel kvm -m 512 -nographic -no-reboot & [1] 2274 openhands@721d061d484b:/workspace/project$ sleep 2 [1]+ Stopped qemu-system-x86_64 -accel kvm -m 512 -nographic -no-reboot openhands@721d061d484b:/workspace/project$ pkill qemuWithout this feature,
/dev/kvmis not there. Also, theqemucommand gives an error.Change Type
Checklist
The changes are relatively straightforward and well written.
Release Notes
Add SANDBOX_KVM_ENABLED environment variable to enable passing /dev/kvm to sandbox containers. When enabled, sandboxes can run KVM-accelerated virtual machines instead of using slower emulation.