From be40646d04d0778118b2effa2357d04a0b42284f Mon Sep 17 00:00:00 2001 From: Fupan Li Date: Wed, 5 Feb 2025 11:10:42 +0800 Subject: [PATCH] runtime-rs: move the sandbox start from sandbox init function Split the sandbox start from the sandbox init process, and call them separately. Signed-off-by: Fupan Li --- src/runtime-rs/crates/runtimes/src/manager.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/runtime-rs/crates/runtimes/src/manager.rs b/src/runtime-rs/crates/runtimes/src/manager.rs index 4c4c4766a8..a729e0d349 100644 --- a/src/runtime-rs/crates/runtimes/src/manager.rs +++ b/src/runtime-rs/crates/runtimes/src/manager.rs @@ -138,14 +138,6 @@ impl RuntimeHandlerManagerInner { Ok(()) } - #[instrument] - async fn start_runtime_handler(&self) -> Result<()> { - if let Some(instance) = self.runtime_instance.as_ref() { - instance.sandbox.start().await.context("start sandbox")?; - } - Ok(()) - } - #[instrument] async fn try_init( &mut self, @@ -200,10 +192,6 @@ impl RuntimeHandlerManagerInner { .await .context("init runtime handler")?; - self.start_runtime_handler() - .await - .context("start runtime handler")?; - // the sandbox creation can reach here only once and the sandbox is created // so we can safely create the shim management socket right now // the unwrap here is safe because the runtime handler is correctly created @@ -411,6 +399,12 @@ impl RuntimeHandlerManager { .await .context("get runtime instance")?; + instance + .sandbox + .start() + .await + .context("start sandbox in task handler")?; + let container_id = container_config.container_id.clone(); let shim_pid = instance .container_manager