Skip to content

Commit

Permalink
remove post_stop hook
Browse files Browse the repository at this point in the history
Signed-off-by: Ziy1-Tan <[email protected]>
  • Loading branch information
Ziy1-Tan committed Oct 16, 2024
1 parent 53e0fe4 commit 78bb4ce
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 48 deletions.
2 changes: 1 addition & 1 deletion vmm/sandbox/src/bin/cloud_hypervisor/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn main() {
KuasarSandboxer::new(
config.sandbox,
config.hypervisor,
CloudHypervisorHooks::new(enable_tracing),
CloudHypervisorHooks::default(),
);

// Do recovery job
Expand Down
2 changes: 1 addition & 1 deletion vmm/sandbox/src/bin/qemu/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn main() {
let sandboxer: KuasarSandboxer<QemuVMFactory, QemuHooks> = KuasarSandboxer::new(
config.sandbox,
config.hypervisor.clone(),
QemuHooks::new(config.hypervisor, enable_tracing),
QemuHooks::new(config.hypervisor),
);

// Run the sandboxer
Expand Down
2 changes: 1 addition & 1 deletion vmm/sandbox/src/bin/stratovirt/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async fn main() {
let mut sandboxer: KuasarSandboxer<StratoVirtVMFactory, StratoVirtHooks> = KuasarSandboxer::new(
config.sandbox,
config.hypervisor.clone(),
StratoVirtHooks::new(config.hypervisor, enable_tracing),
StratoVirtHooks::new(config.hypervisor),
);

// Do recovery job
Expand Down
19 changes: 2 additions & 17 deletions vmm/sandbox/src/cloud_hypervisor/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CloudHypervisorVM> for CloudHypervisorHooks {
Expand All @@ -45,13 +37,6 @@ impl Hooks<CloudHypervisorVM> for CloudHypervisorHooks {
sandbox.sync_clock().await;
Ok(())
}

async fn post_stop(&self, _sandbox: &mut KuasarSandbox<CloudHypervisorVM>) -> Result<()> {
if self.enable_tracing {
tracer::shutdown_tracing();
}
Ok(())
}
}

async fn process_annotation(_sandbox: &mut KuasarSandbox<CloudHypervisorVM>) -> Result<()> {
Expand Down
16 changes: 2 additions & 14 deletions vmm/sandbox/src/qemu/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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 }
}
}

Expand All @@ -54,13 +49,6 @@ impl Hooks<QemuVM> for QemuHooks {
sandbox.sync_clock().await;
Ok(())
}

async fn post_stop(&self, _sandbox: &mut KuasarSandbox<QemuVM>) -> Result<()> {
if self.enable_tracing {
tracer::shutdown_tracing();
}
Ok(())
}
}

async fn process_annotation(_sandbox: &KuasarSandbox<QemuVM>) -> Result<()> {
Expand Down
16 changes: 2 additions & 14 deletions vmm/sandbox/src/stratovirt/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 }
}
}

Expand All @@ -52,11 +47,4 @@ impl Hooks<StratoVirtVM> for StratoVirtHooks {
sandbox.sync_clock().await;
Ok(())
}

async fn post_stop(&self, _sandbox: &mut KuasarSandbox<StratoVirtVM>) -> Result<()> {
if self.enable_tracing {
tracer::shutdown_tracing();
}
Ok(())
}
}

0 comments on commit 78bb4ce

Please sign in to comment.