mirror of
https://github.com/containers/podman.git
synced 2025-10-17 03:04:21 +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:
@ -77,7 +77,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
|
||||
// containers. The container ID is mapped to the error encountered. The error is
|
||||
// set to ErrCtrExists
|
||||
// If both error and the map are nil, all containers were stopped without error
|
||||
func (p *Pod) Stop(cleanup bool) (map[string]error, error) {
|
||||
func (p *Pod) Stop(ctx context.Context, cleanup bool) (map[string]error, error) {
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
@ -118,7 +118,7 @@ func (p *Pod) Stop(cleanup bool) (map[string]error, error) {
|
||||
}
|
||||
|
||||
if cleanup {
|
||||
if err := ctr.cleanup(); err != nil {
|
||||
if err := ctr.cleanup(ctx); err != nil {
|
||||
ctrErrors[ctr.ID()] = err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user