mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 11:05:46 +00:00
vmm: Enable snapshot feature
This connects the dots together, making the request from the user reach the actual implementation for snapshotting the VM. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
2cd0bc0a2c
commit
53613319cc
@ -29,7 +29,7 @@ use std::path::PathBuf;
|
|||||||
use std::sync::mpsc::{Receiver, RecvError, SendError, Sender};
|
use std::sync::mpsc::{Receiver, RecvError, SendError, Sender};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::{result, thread};
|
use std::{result, thread};
|
||||||
use vm_migration::Pausable;
|
use vm_migration::{Pausable, Snapshottable, Transportable};
|
||||||
use vmm_sys_util::eventfd::EventFd;
|
use vmm_sys_util::eventfd::EventFd;
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -291,8 +291,17 @@ impl Vmm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vm_snapshot(&mut self, _destination_url: &str) -> result::Result<(), VmError> {
|
fn vm_snapshot(&mut self, destination_url: &str) -> result::Result<(), VmError> {
|
||||||
Ok(())
|
if let Some(ref mut vm) = self.vm {
|
||||||
|
vm.snapshot()
|
||||||
|
.map_err(VmError::Snapshot)
|
||||||
|
.and_then(|snapshot| {
|
||||||
|
vm.send(&snapshot, destination_url)
|
||||||
|
.map_err(VmError::SnapshotSend)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Err(VmError::VmNotRunning)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vm_restore(&mut self, _source_url: &str) -> result::Result<(), VmError> {
|
fn vm_restore(&mut self, _source_url: &str) -> result::Result<(), VmError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user