mirror of
https://github.com/CloudNebulaProject/vm-manager.git
synced 2026-04-10 13:20:41 +00:00
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.
This commit is contained in:
parent
633e76bad1
commit
4c73599379
1 changed files with 11 additions and 1 deletions
|
|
@ -30,11 +30,21 @@ impl RouterHypervisor {
|
||||||
/// On illumos, creates a PropolisBackend with the given ZFS pool.
|
/// On illumos, creates a PropolisBackend with the given ZFS pool.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub fn new(bridge: Option<String>, zfs_pool: Option<String>) -> Self {
|
pub fn new(bridge: Option<String>, zfs_pool: Option<String>) -> 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<String>,
|
||||||
|
zfs_pool: Option<String>,
|
||||||
|
data_dir: Option<std::path::PathBuf>,
|
||||||
|
) -> Self {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
RouterHypervisor {
|
RouterHypervisor {
|
||||||
noop: noop::NoopBackend,
|
noop: noop::NoopBackend,
|
||||||
qemu: Some(qemu::QemuBackend::new(None, None, bridge)),
|
qemu: Some(qemu::QemuBackend::new(None, data_dir, bridge)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "illumos")]
|
#[cfg(target_os = "illumos")]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue