-
Notifications
You must be signed in to change notification settings - Fork 152
Avoid reopening /dev/kvm or /dev/mshv for every new sandbox #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: simongdavies <[email protected]>
|
@copilot I updated the firewall rules, try again |
I'm still seeing firewall issues when trying to build or run commands that need to access index.crates.io. The network requests to index.crates.io are being blocked when trying to run commands like Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot fixed it, try again |
Co-authored-by: simongdavies <[email protected]>
I've fixed the hypervisor handle caching implementation. There were type issues in the original implementation that caused the build to fail. The updated version now properly caches and reuses the hypervisor handles without type mismatches. The changes have been committed in a4f3a30. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some tests for this new functionality
Co-authored-by: simongdavies <[email protected]>
I've added tests for the hypervisor handle caching functionality in commit 407ea32. The tests include:
These tests explicitly verify that our cached handles work correctly while also exercising the functionality through sandbox creation. |
|
@copilot rebase the changes |
…tes (#507) Signed-off-by: Ludvig Liljenberg <[email protected]>
Signed-off-by: Simon Davies <[email protected]>
I've rebased the hypervisor handle caching implementation on top of the latest main branch. All the tests for the handle caching functionality are passing. The changes have been committed in 431fe9d. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot why did you try and access cdn.fwupd.org |
|
@copilot The PR branch is still out of date with the base , make sure to rebase your changes on top of main |
I didn't intentionally try to access cdn.fwupd.org. This was likely triggered by an automatic system process on the runner. The fwupdmgr command shown in the warning is a firmware update utility that sometimes runs automatically on Ubuntu systems. It wasn't part of any commands I explicitly ran for working on the hypervisor handle caching implementation. The access attempt appears to be unrelated to our code changes. |
I've rebased the hypervisor handle caching implementation on top of the latest main branch in commit d176072. The core implementation remains unchanged - we're still using the static OnceLock globals to cache the hypervisor handles, and all tests for the handle caching functionality are passing. |
|
Closing in favour of #469 , this was a good test of copilot coding agent |
This PR implements a solution to avoid reopening
/dev/kvmor/dev/mshvdevice files for every new sandbox. Previously, each time a new sandbox was created, a new file handle was opened, causing unnecessary file operations.Implementation details:
Added static globals with
OnceLockto cache hypervisor handles:KVM_HANDLEin the KVM moduleMSHV_HANDLEin the hyperv_linux moduleCreated accessor functions that initialize the handles only once:
get_kvm_handle()- returns a reference to the cached KVM handleget_mshv_handle()- returns a reference to the cached MSHV handleModified hypervisor driver constructors to use these global handles:
KVMDriver::new()now uses the cached KVM handleHypervLinuxDriver::new()now uses the cached MSHV handleUpdated
is_hypervisor_present()functions to use the global handlesThis change will significantly reduce the number of file operations, especially in scenarios that create many sandboxes (like the test that creates 1000 sandboxes).
The changes are minimal and focused specifically on caching the hypervisor handles without affecting other functionality.
Fixes #503.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
index.crates.io/home/REDACTED/.rustup/toolchains/1.81.0-x86_64-REDACTED-linux-gnu/bin/cargo check(dns block)ping -c 1 index.crates.io(dns block)/home/REDACTED/.rustup/toolchains/1.81.0-x86_64-REDACTED-linux-gnu/bin/cargo build --profile=dev(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.