vm-migration: Make snapshot() mutable

There will be some cases where the implementation of the snapshot()
function from the Snapshottable trait will require to modify some
internal data, therefore we make this possible by updating the trait
definition with snapshot(&mut self).

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-08-21 14:31:58 +02:00
committed by Samuel Ortiz
parent 7b898285d5
commit 871138d5cc
21 changed files with 22 additions and 22 deletions

View File

@@ -70,7 +70,7 @@ impl Snapshottable for Gic {
GIC_SNAPSHOT_ID.to_string()
}
fn snapshot(&self) -> std::result::Result<Snapshot, MigratableError> {
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
unimplemented!();
}

View File

@@ -405,7 +405,7 @@ impl Snapshottable for Ioapic {
self.id.clone()
}
fn snapshot(&self) -> std::result::Result<Snapshot, MigratableError> {
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
let snapshot =
serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?;

View File

@@ -289,7 +289,7 @@ impl Snapshottable for Serial {
self.id.clone()
}
fn snapshot(&self) -> std::result::Result<Snapshot, MigratableError> {
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
let snapshot =
serde_json::to_vec(&self.state()).map_err(|e| MigratableError::Snapshot(e.into()))?;