vmm: Move VM shutdown event to Vmm::vm_shutdown

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2024-03-21 10:14:45 -07:00
parent 5997cfacbf
commit 6922e25e78
2 changed files with 7 additions and 3 deletions

View File

@ -1381,11 +1381,17 @@ impl RequestHandler for Vmm {
}
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()
} else {
Err(VmError::VmNotRunning)
};
if r.is_ok() {
event!("vm", "shutdown");
}
r
}
fn vm_reboot(&mut self) -> result::Result<(), VmError> {

View File

@ -1397,8 +1397,6 @@ impl Vm {
}
*state = new_state;
event!("vm", "shutdown");
Ok(())
}