diff options
Diffstat (limited to 'libpod/runtime_pod.go')
-rw-r--r-- | libpod/runtime_pod.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/runtime_pod.go b/libpod/runtime_pod.go index 280699b79..19e32d1b0 100644 --- a/libpod/runtime_pod.go +++ b/libpod/runtime_pod.go @@ -26,6 +26,16 @@ type PodFilter func(*Pod) bool // being removed // Otherwise, the pod will not be removed if any containers are running func (r *Runtime) RemovePod(ctx context.Context, p *Pod, removeCtrs, force bool) error { + r.lock.Lock() + defer r.lock.Unlock() + + if !r.valid { + return ErrRuntimeStopped + } + + p.lock.Lock() + defer p.lock.Unlock() + return r.removePod(ctx, p, removeCtrs, force) } |