- Fork and clone the repo
- Install Rust (stable): https://rustup.rs
- Run
cargo test --libto verify your setup
- Xcode Command Line Tools required
- FFI smoke tests need the
com.apple.security.virtualizationentitlement - Full VM lifecycle tests need entitled hardware (not available on CI runners)
- Install Cloud Hypervisor: https://github.com/cloud-hypervisor/cloud-hypervisor/releases
- KVM access required for VM tests (
sudo chmod 666 /dev/kvm) genisoimagefor seed ISO tests:sudo apt install genisoimage
# Build
cargo build
# Run all tests
cargo test
# Lint
cargo clippy -- -D warnings
# Format
cargo fmt- No
unwrap()in library code. Propagate errors with?or handle explicitly. - Typed structs over
serde_json::Value. All JSON has a corresponding Rust type. unsafeblocks must have// SAFETY:comments explaining the invariants.- Log levels match severity:
error!for data loss/crashes,warn!for degraded,info!for operations,debug!for diagnostics.
src/
lib.rs Public API re-exports
config.rs VmConfig, VmHandle, VmState
vm.rs VmManager (multi-VM orchestration)
driver/
mod.rs VmDriver trait + VmError
apple_vz.rs macOS driver (Apple Virtualization.framework)
cloud_hv.rs Linux driver (Cloud Hypervisor CLI)
ffi/apple_vz/ Objective-C FFI bindings for VZ framework
network/
switch.rs Userspace L2 Ethernet switch (macOS)
bridge.rs Linux bridge/TAP networking
port_forward.rs TCP port forwarding
oci/
registry.rs OCI distribution client (pull images)
store.rs Content-addressable blob store
setup/
image.rs Image download and caching
seed.rs Cloud-init seed ISO generation
ssh.rs SSH key generation
tests/ Integration tests (one file per concern)
initramfs/init Custom PID 1 init script for VM guests
- FFI binding (macOS): Add the ObjC wrapper in
src/ffi/apple_vz/ - Config field: Add to
VmConfiginsrc/config.rs - Wire into driver: Use the new FFI/config in
apple_vz.rsorcloud_hv.rs - Test: Add a smoke test in
tests/ffi_smoke.rsand a mock test intests/vm_manager.rs - Document: Update
CAPABILITIES.mdwith the correct status
- Keep PRs focused — one concern per PR
- All tests must pass (
cargo test) - Clippy must be clean (
cargo clippy -- -D warnings) - Code must be formatted (
cargo fmt --check) - Update CAPABILITIES.md if you change what's supported
Open an issue at https://github.com/8Network/vm-rs/issues with:
- Platform (macOS version / Linux distro)
- Rust version (
rustc --version) - Steps to reproduce
- Error output / panic backtrace