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 <fupan.lfp@antgroup.com>
This commit is contained in:
Fupan Li
2025-02-05 11:10:42 +08:00
committed by Pavel Mores
parent 438f81b108
commit be40646d04

View File

@@ -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