vmm: Add a VmRestore command

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2020-02-26 00:03:06 +01:00
committed by Rob Bradford
parent 39d4f817f0
commit 92c73c3b78
4 changed files with 72 additions and 0 deletions
+12
View File
@@ -292,6 +292,10 @@ impl Vmm {
Ok(())
}
fn vm_restore(&mut self, _source_url: &str) -> result::Result<(), VmError> {
Ok(())
}
fn vm_shutdown(&mut self) -> result::Result<(), VmError> {
if let Some(ref mut vm) = self.vm.take() {
vm.shutdown()
@@ -601,6 +605,14 @@ impl Vmm {
sender.send(response).map_err(Error::ApiResponseSend)?;
}
ApiRequest::VmRestore(snapshot_data, sender) => {
let response = self
.vm_restore(&snapshot_data.source_url)
.map_err(ApiError::VmRestore)
.map(|_| ApiResponsePayload::Empty);
sender.send(response).map_err(Error::ApiResponseSend)?;
}
ApiRequest::VmmShutdown(sender) => {
let response = self
.vmm_shutdown()