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 <bo.arvin.chen@gmail.com>
This commit is contained in:
Bo Chen 2024-12-13 14:30:11 -08:00 committed by Wei Liu
parent 0cb2c86ff4
commit 07821c08c0

View File

@ -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)?;