diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/runtime_pod.go | 14 | ||||
-rw-r--r-- | libpod/runtime_pod_linux.go | 8 | ||||
-rw-r--r-- | libpod/runtime_pod_unsupported.go | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/libpod/runtime_pod.go b/libpod/runtime_pod.go index af277c5cc..34925c2d5 100644 --- a/libpod/runtime_pod.go +++ b/libpod/runtime_pod.go @@ -1,5 +1,9 @@ package libpod +import ( + "context" +) + // Contains the public Runtime API for pods // A PodCreateOption is a functional option which alters the Pod created by @@ -11,6 +15,16 @@ type PodCreateOption func(*Pod) error // will include the pod, a false return will exclude it. type PodFilter func(*Pod) bool +// RemovePod removes a pod +// If removeCtrs is specified, containers will be removed +// Otherwise, a pod that is not empty will return an error and not be removed +// If force is specified with removeCtrs, all containers will be stopped before +// 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 { + return r.removePod(ctx, p, removeCtrs, force) +} + // GetPod retrieves a pod by its ID func (r *Runtime) GetPod(id string) (*Pod, error) { r.lock.RLock() diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go index 0edac9dbe..35d095ba3 100644 --- a/libpod/runtime_pod_linux.go +++ b/libpod/runtime_pod_linux.go @@ -77,13 +77,7 @@ func (r *Runtime) NewPod(options ...PodCreateOption) (*Pod, error) { return nil, ErrNotImplemented } -// RemovePod removes a pod -// If removeCtrs is specified, containers will be removed -// Otherwise, a pod that is not empty will return an error and not be removed -// If force is specified with removeCtrs, all containers will be stopped before -// 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 { +func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool) error { r.lock.Lock() defer r.lock.Unlock() diff --git a/libpod/runtime_pod_unsupported.go b/libpod/runtime_pod_unsupported.go index b22f151d8..7cecb7c56 100644 --- a/libpod/runtime_pod_unsupported.go +++ b/libpod/runtime_pod_unsupported.go @@ -11,6 +11,6 @@ func (r *Runtime) NewPod(options ...PodCreateOption) (*Pod, error) { return nil, ErrOSNotSupported } -func (r *Runtime) RemovePod(ctx context.Context, p *Pod, removeCtrs, force bool) error { +func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool) error { return ErrOSNotSupported } |