vmm: api: Add a Snapshot command

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-11-24 18:39:06 +01:00
committed by Rob Bradford
parent 452475c280
commit cf8f8ce93a
3 changed files with 49 additions and 0 deletions

View File

@@ -288,6 +288,10 @@ impl Vmm {
}
}
fn vm_snapshot(&mut self, _destination_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()
@@ -589,6 +593,14 @@ impl Vmm {
sender.send(response).map_err(Error::ApiResponseSend)?;
}
ApiRequest::VmSnapshot(snapshot_data, sender) => {
let response = self
.vm_snapshot(&snapshot_data.destination_url)
.map_err(ApiError::VmSnapshot)
.map(|_| ApiResponsePayload::Empty);
sender.send(response).map_err(Error::ApiResponseSend)?;
}
ApiRequest::VmmShutdown(sender) => {
let response = self
.vmm_shutdown()