runtime-rs: fix ctr exit failed

During use, there will be cases where the container is in the stop state
and get another stop. In this case, the second stop needs to be ignored.

Fixes: #4683
Signed-off-by: Quanwei Zhou <quanweiZhou@linux.alibaba.com>
This commit is contained in:
Quanwei Zhou 2022-07-18 21:44:18 +08:00 committed by quanwei.zqw
parent 9f49f7adca
commit cebbebbe8a

View File

@ -193,7 +193,13 @@ impl ContainerInner {
) -> Result<()> {
let logger = logger_with_process(process);
info!(logger, "begin to stop process");
// do not stop again when state stopped, may cause multi cleanup resource
let state = self.init_process.get_status().await;
if state == ProcessStatus::Stopped {
return Ok(());
}
self.check_state(vec![ProcessStatus::Running])
.await
.context("check state")?;