mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-05-17 04:52:23 +00:00
runtime-rs: Avoid shutting down sandbox on container exit
Prevent the sandbox from being prematurely shut down when a standard workload container exits. Previously, the shutdown logic incorrectly triggered a sandbox shutdown whenever the container list became empty. This resulted in unintended lifecycle termination for non-transient sandboxes. This change refines the `need_shutdown_sandbox()` criteria in `virt_container/src/container_manager/manager.rs` to only initiate a shutdown under specific conditions: - The shutdown request is explicit (`req.is_now`). - The request targets the sandbox itself (`req.container_id == self.sid`). By removing the implicit dependency on the empty container list, we ensure the sandbox remains active as expected after workload containers finish execution. Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -460,7 +460,7 @@ impl ContainerManager for VirtContainerManager {
|
||||
|
||||
#[instrument]
|
||||
async fn need_shutdown_sandbox(&self, req: &ShutdownRequest) -> bool {
|
||||
req.is_now || self.containers.read().await.is_empty() || self.sid == req.container_id
|
||||
req.is_now || self.sid == req.container_id
|
||||
}
|
||||
|
||||
#[instrument]
|
||||
|
||||
Reference in New Issue
Block a user