From 07821c08c0387f6144ba393317e507a79b544cf7 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Fri, 13 Dec 2024 14:30:11 -0800 Subject: [PATCH] vmm: Always re-generate the 'console_info' with VM restore With VM restore, the VMM is always re-creating a VM based on the restored `VmConfig`. We should always re-generate the 'console_info' from the `Vmm` struct to stay consistent with the new VM being created. Signed-off-by: Bo Chen --- vmm/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 8a197b732..8c904586f 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1558,11 +1558,9 @@ impl RequestHandler for Vmm { self.vm_config = Some(Arc::clone(&vm_config)); - // console_info is set to None in vm_snapshot. re-populate here if empty - if self.console_info.is_none() { - self.console_info = - Some(pre_create_console_devices(self).map_err(VmError::CreateConsoleDevices)?); - } + // Always re-populate the 'console_info' based on the new 'vm_config' + self.console_info = + Some(pre_create_console_devices(self).map_err(VmError::CreateConsoleDevices)?); let exit_evt = self.exit_evt.try_clone().map_err(VmError::EventFdClone)?; let reset_evt = self.reset_evt.try_clone().map_err(VmError::EventFdClone)?;