mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-04 02:14:29 +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,
|
signal: u32,
|
||||||
all: bool,
|
all: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
if self.check_state(vec![ProcessStatus::Stopped]).await.is_ok() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let mut process_id: agent::ContainerProcessID = process.clone().into();
|
let mut process_id: agent::ContainerProcessID = process.clone().into();
|
||||||
if all {
|
if all {
|
||||||
// force signal init process
|
// force signal init process
|
||||||
|
@@ -471,8 +471,15 @@ impl Sandbox for VirtSandbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn stop(&self) -> Result<()> {
|
async fn stop(&self) -> Result<()> {
|
||||||
info!(sl!(), "begin stop sandbox");
|
let mut sandbox_inner = self.inner.write().await;
|
||||||
self.hypervisor.stop_vm().await.context("stop vm")?;
|
|
||||||
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user