From 78bb4ce73d3109b533945d4b1e27948f3f98508f Mon Sep 17 00:00:00 2001 From: Ziy1-Tan Date: Wed, 16 Oct 2024 23:16:52 +0800 Subject: [PATCH] remove post_stop hook Signed-off-by: Ziy1-Tan --- vmm/sandbox/src/bin/cloud_hypervisor/main.rs | 2 +- vmm/sandbox/src/bin/qemu/main.rs | 2 +- vmm/sandbox/src/bin/stratovirt/main.rs | 2 +- vmm/sandbox/src/cloud_hypervisor/hooks.rs | 19 ++----------------- vmm/sandbox/src/qemu/hooks.rs | 16 ++-------------- vmm/sandbox/src/stratovirt/hooks.rs | 16 ++-------------- 6 files changed, 9 insertions(+), 48 deletions(-) diff --git a/vmm/sandbox/src/bin/cloud_hypervisor/main.rs b/vmm/sandbox/src/bin/cloud_hypervisor/main.rs index 46b8a551..38688276 100644 --- a/vmm/sandbox/src/bin/cloud_hypervisor/main.rs +++ b/vmm/sandbox/src/bin/cloud_hypervisor/main.rs @@ -47,7 +47,7 @@ async fn main() { KuasarSandboxer::new( config.sandbox, config.hypervisor, - CloudHypervisorHooks::new(enable_tracing), + CloudHypervisorHooks::default(), ); // Do recovery job diff --git a/vmm/sandbox/src/bin/qemu/main.rs b/vmm/sandbox/src/bin/qemu/main.rs index ca3194b2..85b81b88 100644 --- a/vmm/sandbox/src/bin/qemu/main.rs +++ b/vmm/sandbox/src/bin/qemu/main.rs @@ -62,7 +62,7 @@ async fn main() { let sandboxer: KuasarSandboxer = KuasarSandboxer::new( config.sandbox, config.hypervisor.clone(), - QemuHooks::new(config.hypervisor, enable_tracing), + QemuHooks::new(config.hypervisor), ); // Run the sandboxer diff --git a/vmm/sandbox/src/bin/stratovirt/main.rs b/vmm/sandbox/src/bin/stratovirt/main.rs index 6ce6d40b..f1c1f2cb 100644 --- a/vmm/sandbox/src/bin/stratovirt/main.rs +++ b/vmm/sandbox/src/bin/stratovirt/main.rs @@ -48,7 +48,7 @@ async fn main() { let mut sandboxer: KuasarSandboxer = KuasarSandboxer::new( config.sandbox, config.hypervisor.clone(), - StratoVirtHooks::new(config.hypervisor, enable_tracing), + StratoVirtHooks::new(config.hypervisor), ); // Do recovery job diff --git a/vmm/sandbox/src/cloud_hypervisor/hooks.rs b/vmm/sandbox/src/cloud_hypervisor/hooks.rs index 6f827707..67e1ccaa 100644 --- a/vmm/sandbox/src/cloud_hypervisor/hooks.rs +++ b/vmm/sandbox/src/cloud_hypervisor/hooks.rs @@ -15,21 +15,13 @@ limitations under the License. */ use containerd_sandbox::error::Result; -use vmm_common::tracer; use crate::{ cloud_hypervisor::CloudHypervisorVM, sandbox::KuasarSandbox, utils::get_resources, vm::Hooks, }; -pub struct CloudHypervisorHooks { - enable_tracing: bool, -} - -impl CloudHypervisorHooks { - pub fn new(enable_tracing: bool) -> Self { - Self { enable_tracing } - } -} +#[derive(Default)] +pub struct CloudHypervisorHooks {} #[async_trait::async_trait] impl Hooks for CloudHypervisorHooks { @@ -45,13 +37,6 @@ impl Hooks for CloudHypervisorHooks { sandbox.sync_clock().await; Ok(()) } - - async fn post_stop(&self, _sandbox: &mut KuasarSandbox) -> Result<()> { - if self.enable_tracing { - tracer::shutdown_tracing(); - } - Ok(()) - } } async fn process_annotation(_sandbox: &mut KuasarSandbox) -> Result<()> { diff --git a/vmm/sandbox/src/qemu/hooks.rs b/vmm/sandbox/src/qemu/hooks.rs index 11cbeda3..8bb6f9f7 100644 --- a/vmm/sandbox/src/qemu/hooks.rs +++ b/vmm/sandbox/src/qemu/hooks.rs @@ -16,7 +16,6 @@ limitations under the License. use async_trait::async_trait; use containerd_sandbox::error::Result; -use vmm_common::tracer; use crate::{ qemu::{config::QemuVMConfig, QemuVM}, @@ -28,15 +27,11 @@ use crate::{ pub struct QemuHooks { #[allow(dead_code)] config: QemuVMConfig, - enable_tracing: bool, } impl QemuHooks { - pub fn new(config: QemuVMConfig, enable_tracing: bool) -> Self { - Self { - config, - enable_tracing, - } + pub fn new(config: QemuVMConfig) -> Self { + Self { config } } } @@ -54,13 +49,6 @@ impl Hooks for QemuHooks { sandbox.sync_clock().await; Ok(()) } - - async fn post_stop(&self, _sandbox: &mut KuasarSandbox) -> Result<()> { - if self.enable_tracing { - tracer::shutdown_tracing(); - } - Ok(()) - } } async fn process_annotation(_sandbox: &KuasarSandbox) -> Result<()> { diff --git a/vmm/sandbox/src/stratovirt/hooks.rs b/vmm/sandbox/src/stratovirt/hooks.rs index 6e023459..0eb4e4e9 100644 --- a/vmm/sandbox/src/stratovirt/hooks.rs +++ b/vmm/sandbox/src/stratovirt/hooks.rs @@ -16,7 +16,6 @@ limitations under the License. use async_trait::async_trait; use containerd_sandbox::error::Result; -use vmm_common::tracer; use crate::{ sandbox::KuasarSandbox, @@ -27,15 +26,11 @@ use crate::{ pub struct StratoVirtHooks { #[allow(dead_code)] config: StratoVirtVMConfig, - enable_tracing: bool, } impl StratoVirtHooks { - pub fn new(config: StratoVirtVMConfig, enable_tracing: bool) -> Self { - Self { - config, - enable_tracing, - } + pub fn new(config: StratoVirtVMConfig) -> Self { + Self { config } } } @@ -52,11 +47,4 @@ impl Hooks for StratoVirtHooks { sandbox.sync_clock().await; Ok(()) } - - async fn post_stop(&self, _sandbox: &mut KuasarSandbox) -> Result<()> { - if self.enable_tracing { - tracer::shutdown_tracing(); - } - Ok(()) - } }