Skip to content

Commit

Permalink
if init is paused/pausing, exec state should be the same
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzzzzzzzy9 committed Aug 1, 2024
1 parent 765111e commit 03873a6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/runc-shim/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -100,6 +102,12 @@ where
async fn state(&self, exec_id: Option<&str>) -> Result<StateResponse> {
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)
Expand Down

0 comments on commit 03873a6

Please sign in to comment.