mirror of
https://github.com/containers/podman.git
synced 2025-10-18 11:42:55 +08:00
Add ContainerStateExited and OCI delete() in cleanup()
To work better with Kata containers, we need to delete() from the OCI runtime as a part of cleanup, to ensure resources aren't retained longer than they need to be. To enable this, we need to add a new state to containers, ContainerStateExited. Containers transition from ContainerStateStopped to ContainerStateExited via cleanupRuntime which is invoked as part of cleanup(). A container in the Exited state is identical to Stopped, except it has been removed from the OCI runtime and thus will be handled differently when initializing the container. Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
This commit is contained in:
@ -311,7 +311,7 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool)
|
||||
c.valid = false
|
||||
|
||||
// Clean up network namespace, cgroups, mounts
|
||||
if err := c.cleanup(); err != nil {
|
||||
if err := c.cleanup(ctx); err != nil {
|
||||
if cleanupErr == nil {
|
||||
cleanupErr = err
|
||||
} else {
|
||||
@ -335,7 +335,8 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool)
|
||||
// Delete the container
|
||||
// Only do this if we're not ContainerStateConfigured - if we are,
|
||||
// we haven't been created in the runtime yet
|
||||
if c.state.State != ContainerStateConfigured {
|
||||
if c.state.State != ContainerStateConfigured &&
|
||||
c.state.State != ContainerStateExited {
|
||||
if err := c.delete(ctx); err != nil {
|
||||
if cleanupErr == nil {
|
||||
cleanupErr = err
|
||||
|
Reference in New Issue
Block a user