From 03873a6ba63c4ca2b630c076d02bb5b0504301a8 Mon Sep 17 00:00:00 2001 From: zzzzzzzzzy9 Date: Thu, 18 Jul 2024 19:13:16 +0800 Subject: [PATCH] if init is paused/pausing, exec state should be the same --- crates/runc-shim/src/container.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/runc-shim/src/container.rs b/crates/runc-shim/src/container.rs index 257e2c60..78519102 100644 --- a/crates/runc-shim/src/container.rs +++ b/crates/runc-shim/src/container.rs @@ -18,10 +18,12 @@ use std::collections::HashMap; use async_trait::async_trait; use containerd_shim::{ + api::Status, error::Result, protos::{ api::{CreateTaskRequest, ExecProcessRequest, ProcessInfo, StateResponse}, cgroups::metrics::Metrics, + protobuf::EnumOrUnknown, }, Error, }; @@ -100,6 +102,12 @@ where async fn state(&self, exec_id: Option<&str>) -> Result { let process = self.get_process(exec_id)?; let mut resp = process.state().await?; + let init_state = self.init.state().await?.status; + if init_state == EnumOrUnknown::new(Status::PAUSING) + || init_state == EnumOrUnknown::new(Status::PAUSED) + { + resp.status = init_state; + } resp.bundle = self.bundle.to_string(); debug!("container state: {:?}", resp); Ok(resp)