mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-01-30 05:52:15 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user