Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
if init is paused/pausing, exec state should be the same
Browse files Browse the repository at this point in the history
zzzzzzzzzy9 committed Dec 4, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 8029a61 commit 37b2299
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
@@ -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,
@@ -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)

0 comments on commit 37b2299

Please sign in to comment.