vmm: device_manager: Make serial and ioapic devices migratable
Serial and Ioapic both implement the Migratable trait, hence the
DeviceManager can store them in the list of Migratable devices.
@@ -591,6 +591,7 @@ impl DeviceManager {
let ioapic =
DeviceManager::add_ioapic(&address_manager, Arc::clone(&msi_interrupt_manager))?;
+ let ioapic_migratable = Arc::clone(&ioapic) as Arc<Mutex<dyn Migratable>>;
bus_devices.push(Arc::clone(&ioapic) as Arc<Mutex<dyn BusDevice>>);
// Now we can create the legacy interrupt manager, which needs the freshly
@@ -651,6 +652,8 @@ impl DeviceManager {
device_manager
.add_legacy_devices(reset_evt.try_clone().map_err(DeviceManagerError::EventFd)?)?;
+ device_manager.add_migratable_device(ioapic_migratable);
+
#[cfg(feature = "acpi")]
{
device_manager.ged_notification_device = device_manager.add_acpi_devices(
@@ -981,6 +984,8 @@ impl DeviceManager {
.insert(serial.clone(), 0x3f8, 0x8)
.map_err(DeviceManagerError::BusError)?;
+ self.add_migratable_device(Arc::clone(&serial) as Arc<Mutex<dyn Migratable>>);
+
Some(serial)
} else {
None
