Preserve vcpus/memory/disk in VmHandle for QEMU start

This commit is contained in:
Till Wegmueller 2026-04-07 21:20:15 +02:00
parent bd598a9c42
commit 9d9f90af1a
3 changed files with 18 additions and 3 deletions

View file

@ -53,6 +53,12 @@ pub struct VmHandle {
pub ssh_host_port: Option<u16>, pub ssh_host_port: Option<u16>,
/// MAC address of the VM's network interface. /// MAC address of the VM's network interface.
pub mac_addr: Option<String>, pub mac_addr: Option<String>,
/// vCPU count (preserved from prepare for start).
pub vcpus: u16,
/// Memory in MB (preserved from prepare for start).
pub memory_mb: u64,
/// Disk size in GB.
pub disk_gb: Option<u32>,
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -99,6 +105,9 @@ impl Hypervisor for NoopHypervisor {
console_socket: None, console_socket: None,
ssh_host_port: None, ssh_host_port: None,
mac_addr: None, mac_addr: None,
vcpus: 0,
memory_mb: 0,
disk_gb: None,
}) })
} }
async fn start(&self, vm: &VmHandle) -> Result<()> { async fn start(&self, vm: &VmHandle) -> Result<()> {

View file

@ -971,6 +971,9 @@ mod tests {
console_socket: None, console_socket: None,
ssh_host_port: None, ssh_host_port: None,
mac_addr: None, mac_addr: None,
vcpus: 0,
memory_mb: 0,
disk_gb: None,
}) })
} }
async fn start(&self, _vm: &VmHandle) -> miette::Result<()> { async fn start(&self, _vm: &VmHandle) -> miette::Result<()> {

View file

@ -196,6 +196,9 @@ fn to_orch_handle(h: &vm_manager::VmHandle) -> VmHandle {
console_socket: h.console_socket.clone(), console_socket: h.console_socket.clone(),
ssh_host_port: h.ssh_host_port, ssh_host_port: h.ssh_host_port,
mac_addr: h.mac_addr.clone(), mac_addr: h.mac_addr.clone(),
vcpus: h.vcpus,
memory_mb: h.memory_mb,
disk_gb: h.disk_gb,
} }
} }
@ -218,9 +221,9 @@ fn to_vm_handle(h: &VmHandle) -> vm_manager::VmHandle {
qmp_socket: Some(h.work_dir.join("qmp.sock")), qmp_socket: Some(h.work_dir.join("qmp.sock")),
console_socket: h.console_socket.clone(), console_socket: h.console_socket.clone(),
vnc_addr: None, vnc_addr: None,
vcpus: 0, vcpus: h.vcpus,
memory_mb: 0, memory_mb: h.memory_mb,
disk_gb: None, disk_gb: h.disk_gb,
network: vm_manager::NetworkConfig::User, network: vm_manager::NetworkConfig::User,
ssh_host_port: h.ssh_host_port, ssh_host_port: h.ssh_host_port,
mac_addr: h.mac_addr.clone(), mac_addr: h.mac_addr.clone(),