mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
Merge pull request #10043 from lifupan/fix_sandbox
runtime-rs : fix the issue of stop sandbox
This commit is contained in:
@@ -275,6 +275,10 @@ impl ContainerInner {
|
||||
signal: u32,
|
||||
all: bool,
|
||||
) -> Result<()> {
|
||||
if self.check_state(vec![ProcessStatus::Stopped]).await.is_ok() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let mut process_id: agent::ContainerProcessID = process.clone().into();
|
||||
if all {
|
||||
// force signal init process
|
||||
|
@@ -471,8 +471,15 @@ impl Sandbox for VirtSandbox {
|
||||
}
|
||||
|
||||
async fn stop(&self) -> Result<()> {
|
||||
info!(sl!(), "begin stop sandbox");
|
||||
self.hypervisor.stop_vm().await.context("stop vm")?;
|
||||
let mut sandbox_inner = self.inner.write().await;
|
||||
|
||||
if sandbox_inner.state != SandboxState::Stopped {
|
||||
info!(sl!(), "begin stop sandbox");
|
||||
self.hypervisor.stop_vm().await.context("stop vm")?;
|
||||
sandbox_inner.state = SandboxState::Stopped;
|
||||
info!(sl!(), "sandbox stopped");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user