mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vmm: Move VM shutdown event to Vmm::vm_shutdown
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
5997cfacbf
commit
6922e25e78
@ -1381,11 +1381,17 @@ impl RequestHandler for Vmm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn vm_shutdown(&mut self) -> result::Result<(), VmError> {
|
fn vm_shutdown(&mut self) -> result::Result<(), VmError> {
|
||||||
if let Some(ref mut vm) = self.vm.take() {
|
let r = if let Some(ref mut vm) = self.vm.take() {
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
} else {
|
} else {
|
||||||
Err(VmError::VmNotRunning)
|
Err(VmError::VmNotRunning)
|
||||||
|
};
|
||||||
|
|
||||||
|
if r.is_ok() {
|
||||||
|
event!("vm", "shutdown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vm_reboot(&mut self) -> result::Result<(), VmError> {
|
fn vm_reboot(&mut self) -> result::Result<(), VmError> {
|
||||||
|
@ -1397,8 +1397,6 @@ impl Vm {
|
|||||||
}
|
}
|
||||||
*state = new_state;
|
*state = new_state;
|
||||||
|
|
||||||
event!("vm", "shutdown");
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user