From 5997cfacbffb3ee0b07db3e88083c79e34c617ee Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Thu, 21 Mar 2024 09:54:23 -0700 Subject: [PATCH] vmm: Move VM boot events to Vmm::vm_boot Signed-off-by: Bo Chen --- vmm/src/lib.rs | 5 +++++ vmm/src/vm.rs | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index c5d4bb876..702cc4da6 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1216,6 +1216,8 @@ impl RequestHandler for Vmm { fn vm_boot(&mut self) -> result::Result<(), VmError> { tracer::start(); + info!("Booting VM"); + event!("vm", "booting"); let r = { trace_scoped!("vm_boot"); // If we don't have a config, we can not boot a VM. @@ -1269,6 +1271,9 @@ impl RequestHandler for Vmm { } }; tracer::end(); + if r.is_ok() { + event!("vm", "booted"); + } r } diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 63a2cee56..c61cfa643 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -2067,8 +2067,6 @@ impl Vm { pub fn boot(&mut self) -> Result<()> { trace_scoped!("Vm::boot"); - info!("Booting VM"); - event!("vm", "booting"); let current_state = self.get_state()?; if current_state == VmState::Paused { return self.resume().map_err(Error::Resume); @@ -2185,7 +2183,6 @@ impl Vm { let mut state = self.state.try_write().map_err(|_| Error::PoisonedState)?; *state = new_state; - event!("vm", "booted"); Ok(()) }