From 4c735993793a8e68a112661e8f661e00850b07db Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Tue, 7 Apr 2026 17:44:53 +0200 Subject: [PATCH] Add with_data_dir constructor to RouterHypervisor Allows callers to specify a custom data directory for VM work files (overlays, sockets, console logs) instead of using the default ~/.local/share/vmctl/vms/ path. Needed for container deployments where the work dir is a mounted volume. --- crates/vm-manager/src/backends/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/vm-manager/src/backends/mod.rs b/crates/vm-manager/src/backends/mod.rs index 0a6f186..6a2a6d2 100644 --- a/crates/vm-manager/src/backends/mod.rs +++ b/crates/vm-manager/src/backends/mod.rs @@ -30,11 +30,21 @@ impl RouterHypervisor { /// On illumos, creates a PropolisBackend with the given ZFS pool. #[allow(unused_variables)] pub fn new(bridge: Option, zfs_pool: Option) -> Self { + Self::with_data_dir(bridge, zfs_pool, None) + } + + /// Build a router with a custom data directory for VM work files. + #[allow(unused_variables)] + pub fn with_data_dir( + bridge: Option, + zfs_pool: Option, + data_dir: Option, + ) -> Self { #[cfg(target_os = "linux")] { RouterHypervisor { noop: noop::NoopBackend, - qemu: Some(qemu::QemuBackend::new(None, None, bridge)), + qemu: Some(qemu::QemuBackend::new(None, data_dir, bridge)), } } #[cfg(target_os = "illumos")]