diff --git a/devices/src/gic.rs b/devices/src/gic.rs index 09623362a..2a67663a9 100644 --- a/devices/src/gic.rs +++ b/devices/src/gic.rs @@ -70,7 +70,7 @@ impl Snapshottable for Gic { GIC_SNAPSHOT_ID.to_string() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { unimplemented!(); } diff --git a/devices/src/ioapic.rs b/devices/src/ioapic.rs index d25f5903b..b402dea1d 100644 --- a/devices/src/ioapic.rs +++ b/devices/src/ioapic.rs @@ -405,7 +405,7 @@ impl Snapshottable for Ioapic { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/devices/src/legacy/serial.rs b/devices/src/legacy/serial.rs index dd8d49cb3..10a1ddb1b 100644 --- a/devices/src/legacy/serial.rs +++ b/devices/src/legacy/serial.rs @@ -289,7 +289,7 @@ impl Snapshottable for Serial { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/pci/src/configuration.rs b/pci/src/configuration.rs index 295d3ee0b..836c0fdf2 100644 --- a/pci/src/configuration.rs +++ b/pci/src/configuration.rs @@ -889,7 +889,7 @@ impl Snapshottable for PciConfiguration { String::from("pci_configuration") } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/pci/src/msix.rs b/pci/src/msix.rs index 1b9850191..4cb566a4c 100644 --- a/pci/src/msix.rs +++ b/pci/src/msix.rs @@ -437,7 +437,7 @@ impl Snapshottable for MsixConfig { String::from("msix_config") } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/block.rs b/virtio-devices/src/block.rs index fd09c2ff7..b78c040d2 100644 --- a/virtio-devices/src/block.rs +++ b/virtio-devices/src/block.rs @@ -620,7 +620,7 @@ impl Snapshottable for Block { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/block_io_uring.rs b/virtio-devices/src/block_io_uring.rs index 41937eb8c..131a5bff1 100644 --- a/virtio-devices/src/block_io_uring.rs +++ b/virtio-devices/src/block_io_uring.rs @@ -670,7 +670,7 @@ impl Snapshottable for BlockIoUring { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/console.rs b/virtio-devices/src/console.rs index 68d9f13ed..03b21a18f 100644 --- a/virtio-devices/src/console.rs +++ b/virtio-devices/src/console.rs @@ -552,7 +552,7 @@ impl Snapshottable for Console { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/iommu.rs b/virtio-devices/src/iommu.rs index 738999841..3ff534993 100644 --- a/virtio-devices/src/iommu.rs +++ b/virtio-devices/src/iommu.rs @@ -1016,7 +1016,7 @@ impl Snapshottable for Iommu { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/net.rs b/virtio-devices/src/net.rs index 82538bd5b..0e40c9c61 100644 --- a/virtio-devices/src/net.rs +++ b/virtio-devices/src/net.rs @@ -565,7 +565,7 @@ impl Snapshottable for Net { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/pmem.rs b/virtio-devices/src/pmem.rs index 5515f99e9..0ba7445bf 100644 --- a/virtio-devices/src/pmem.rs +++ b/virtio-devices/src/pmem.rs @@ -524,7 +524,7 @@ impl Snapshottable for Pmem { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/rng.rs b/virtio-devices/src/rng.rs index 3bd9d6ead..dca85337a 100644 --- a/virtio-devices/src/rng.rs +++ b/virtio-devices/src/rng.rs @@ -348,7 +348,7 @@ impl Snapshottable for Rng { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/transport/mmio.rs b/virtio-devices/src/transport/mmio.rs index 0e97d6457..ddc0adaba 100644 --- a/virtio-devices/src/transport/mmio.rs +++ b/virtio-devices/src/transport/mmio.rs @@ -462,7 +462,7 @@ impl Snapshottable for MmioDevice { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/transport/pci_common_config.rs b/virtio-devices/src/transport/pci_common_config.rs index 6d8504057..5e4fc7d1b 100644 --- a/virtio-devices/src/transport/pci_common_config.rs +++ b/virtio-devices/src/transport/pci_common_config.rs @@ -290,7 +290,7 @@ impl Snapshottable for VirtioPciCommonConfig { String::from("virtio_pci_common_config") } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/transport/pci_device.rs b/virtio-devices/src/transport/pci_device.rs index e293ab66b..a52f9085b 100644 --- a/virtio-devices/src/transport/pci_device.rs +++ b/virtio-devices/src/transport/pci_device.rs @@ -1040,7 +1040,7 @@ impl Snapshottable for VirtioPciDevice { self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/virtio-devices/src/vsock/device.rs b/virtio-devices/src/vsock/device.rs index 484fa6750..6e8787186 100644 --- a/virtio-devices/src/vsock/device.rs +++ b/virtio-devices/src/vsock/device.rs @@ -535,7 +535,7 @@ where self.id.clone() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?; diff --git a/vm-migration/src/lib.rs b/vm-migration/src/lib.rs index e42bbb61e..0d98b657d 100644 --- a/vm-migration/src/lib.rs +++ b/vm-migration/src/lib.rs @@ -111,7 +111,7 @@ pub trait Snapshottable: Pausable { } /// Take a component snapshot. - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { Ok(Snapshot::new("")) } diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index b29f8d68b..5381adc0d 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -400,7 +400,7 @@ impl Snapshottable for Vcpu { VCPU_SNAPSHOT_ID.to_string() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let snapshot = serde_json::to_vec(&self.saved_state) .map_err(|e| MigratableError::Snapshot(e.into()))?; @@ -1368,7 +1368,7 @@ impl Snapshottable for CpuManager { CPU_MANAGER_SNAPSHOT_ID.to_string() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let mut cpu_manager_snapshot = Snapshot::new(CPU_MANAGER_SNAPSHOT_ID); // The CpuManager snapshot is a collection of all vCPUs snapshots. diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index f0168c52d..549e32fe6 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -3626,7 +3626,7 @@ impl Snapshottable for DeviceManager { DEVICE_MANAGER_SNAPSHOT_ID.to_string() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let mut snapshot = Snapshot::new(DEVICE_MANAGER_SNAPSHOT_ID); // We aggregate all devices snapshots. diff --git a/vmm/src/memory_manager.rs b/vmm/src/memory_manager.rs index 32e3b147c..745422cb7 100644 --- a/vmm/src/memory_manager.rs +++ b/vmm/src/memory_manager.rs @@ -1526,7 +1526,7 @@ impl Snapshottable for MemoryManager { MEMORY_MANAGER_SNAPSHOT_ID.to_string() } - fn snapshot(&self) -> result::Result { + fn snapshot(&mut self) -> result::Result { if self.use_zones { return Err(MigratableError::Snapshot(anyhow!( "Not allowed to snapshot guest memory when backed with user \ diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 764672942..16fb30b22 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -1267,7 +1267,7 @@ impl Snapshottable for Vm { VM_SNAPSHOT_ID.to_string() } - fn snapshot(&self) -> std::result::Result { + fn snapshot(&mut self) -> std::result::Result { let current_state = self.get_state().unwrap(); if current_state != VmState::Paused { return Err(MigratableError::Snapshot(anyhow!(