feat(vm): add openshell-vm crate with libkrun microVM gateway#611
Draft
feat(vm): add openshell-vm crate with libkrun microVM gateway#611
Conversation
Fix targeted gvproxy kill to use tracked PID from runtime state instead of pkill, gate diagnostic dump behind OPENSHELL_VM_DIAG env var, stream SHA-256 hashing to avoid buffering entire files, clarify operator precedence in env var validation, replace hand-rolled JSON parser with serde_json, deduplicate required_runtime_lib_name(), and add openshell-vm to AGENTS.md architecture table.
3cc1759 to
d06b90b
Compare
- Gate krun_add_net_unixgram FFI type, struct field, and VmContext method behind #[cfg(target_os = "macos")] to eliminate dead_code warnings on Linux - Add krun_add_net_unixstream FFI binding and add_net_unixstream VmContext method for Linux SOCK_STREAM networking via gvproxy QEMU listener - Switch gvproxy launch flags: -listen-qemu (Linux) vs -listen-vfkit (macOS) - Add recover_stale_kine_db: removes corrupt or bootstrap-locked SQLite kine database before boot so k3s always starts with a clean schema - Drop version segment from rootfs and runtime cache paths to avoid stale directories accumulating across upgrades - Improve build-libkrun.sh: two-phase kernel config merge using merge_config.sh and auto-detect LIBCLANG_PATH for clang-sys on Debian/Ubuntu - Ensure libkrunfw.so.5 soname file is present alongside versioned artifact - Add bundle-vm-runtime.sh task and vm:bundle-runtime mise target - Pin AGENT_SANDBOX_IMAGE to updated digest - Add pyelftools dev dependency
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
Adds the
openshell-vmcrate — a new microVM runtime that uses libkrun to boot lightweight VMs with hardware isolation. On macOS ARM64 it leverages Apple's Hypervisor.framework; on Linux it uses KVM. This provides a single-binary alternative to the Docker/k3s-based gateway deployment.Changes
crates/openshell-vm/crate with:lib.rs: VmConfig builder, libkrun FFI wrapper, VM lifecycle (launch, exec, reset)ffi.rs: Dynamic loading oflibkrun.dylib/libkrun.sovialibloadingexec.rs:openshell-vm execsupport to run commands inside a running VM via vsockmain.rs: Standalone CLI binary with--exec,--port,--vcpus,--mem,--net,--resetflagsbuild-rootfs.sh,openshell-vm-init.sh,sync-vm-rootfs.sh,check-vm-capabilities.sh, helper Python scriptstasks/vm.tomland associated scriptsarchitecture/custom-vm-runtime.mdopenshell-coreandopenshell-bootstrapfor VM rootfs/runtime directoriestests/gateway_integration.rsTesting
crates/openshell-vm/tests/gateway_integration.rs)mise run pre-commitpassesChecklist
architecture/custom-vm-runtime.md)