mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 11:06:21 +00:00
Merge pull request #6399 from yipengyin/fix-cleanup
fix(runtime-rs): add exited state to ensure cleanup
This commit is contained in:
commit
60bb9d114a
@ -184,6 +184,7 @@ pub enum ProcessStatus {
|
|||||||
Stopped = 3,
|
Stopped = 3,
|
||||||
Paused = 4,
|
Paused = 4,
|
||||||
Pausing = 5,
|
Pausing = 5,
|
||||||
|
Exited = 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -56,6 +56,7 @@ impl From<ProcessStatus> for api::Status {
|
|||||||
ProcessStatus::Stopped => api::Status::STOPPED,
|
ProcessStatus::Stopped => api::Status::STOPPED,
|
||||||
ProcessStatus::Paused => api::Status::PAUSED,
|
ProcessStatus::Paused => api::Status::PAUSED,
|
||||||
ProcessStatus::Pausing => api::Status::PAUSING,
|
ProcessStatus::Pausing => api::Status::PAUSING,
|
||||||
|
ProcessStatus::Exited => api::Status::STOPPED,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,10 +200,11 @@ impl ContainerInner {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
self.check_state(vec![ProcessStatus::Running])
|
self.check_state(vec![ProcessStatus::Running, ProcessStatus::Exited])
|
||||||
.await
|
.await
|
||||||
.context("check state")?;
|
.context("check state")?;
|
||||||
|
|
||||||
|
if state == ProcessStatus::Running {
|
||||||
// if use force mode to stop container, stop always successful
|
// if use force mode to stop container, stop always successful
|
||||||
// send kill signal to container
|
// send kill signal to container
|
||||||
// ignore the error of sending signal, since the process would
|
// ignore the error of sending signal, since the process would
|
||||||
@ -214,6 +215,7 @@ impl ContainerInner {
|
|||||||
warn!(logger, "failed to signal kill. {:?}", e);
|
warn!(logger, "failed to signal kill. {:?}", e);
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
|
}
|
||||||
|
|
||||||
match process.process_type {
|
match process.process_type {
|
||||||
ProcessType::Container => self
|
ProcessType::Container => self
|
||||||
|
@ -182,7 +182,7 @@ impl Process {
|
|||||||
drop(exit_status);
|
drop(exit_status);
|
||||||
|
|
||||||
let mut status = status.write().await;
|
let mut status = status.write().await;
|
||||||
*status = ProcessStatus::Stopped;
|
*status = ProcessStatus::Exited;
|
||||||
drop(status);
|
drop(status);
|
||||||
|
|
||||||
drop(exit_notifier);
|
drop(exit_notifier);
|
||||||
|
Loading…
Reference in New Issue
Block a user