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 authored and mxpv committed Dec 4, 2024
1 parent 8029a61 commit 7051e31
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/runc-shim/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +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::{well_known_types::any::Any, Message, MessageDyn},
protobuf::{well_known_types::any::Any, EnumOrUnknown, Message, MessageDyn},
shim::oci::ProcessDetails,
},
Error,
Expand Down Expand Up @@ -104,6 +105,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 7051e31

Please sign in to comment.