aboutsummaryrefslogtreecommitdiff
path: root/libpod/runtime_ctr.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2017-11-29 00:05:23 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-29 12:15:16 +0000
commitce3081786b6573abad764ac425fb9b7c5b74c465 (patch)
tree963688c283f3ba7bdbfeb3961313b638fe8aac45 /libpod/runtime_ctr.go
parent4a68a5303c74298f50c4a2d51e75527d439f09f1 (diff)
downloadpodman-ce3081786b6573abad764ac425fb9b7c5b74c465.tar.gz
podman-ce3081786b6573abad764ac425fb9b7c5b74c465.tar.bz2
podman-ce3081786b6573abad764ac425fb9b7c5b74c465.zip
Fix rmi -f removing containers from storage without telling libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #68 Approved by: rhatdan
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r--libpod/runtime_ctr.go34
1 files changed, 6 insertions, 28 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 32902d9c6..8613950f6 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -1,7 +1,6 @@
package libpod
import (
- "github.com/containers/storage"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -86,6 +85,12 @@ func (r *Runtime) RemoveContainer(c *Container, force bool) error {
r.lock.Lock()
defer r.lock.Unlock()
+ return r.removeContainer(c, force)
+}
+
+// Internal function to remove a container
+// Locks the container, but does not lock the runtime
+func (r *Runtime) removeContainer(c *Container, force bool) error {
c.lock.Lock()
defer c.lock.Unlock()
@@ -210,30 +215,3 @@ func (r *Runtime) GetContainers(filters ...ContainerFilter) ([]*Container, error
return ctrsFiltered, nil
}
-
-// getContainersWithImage returns a list of containers referencing imageID
-func (r *Runtime) getContainersWithImage(imageID string) ([]storage.Container, error) {
- var matchingContainers []storage.Container
- containers, err := r.store.Containers()
- if err != nil {
- return nil, err
- }
-
- for _, ctr := range containers {
- if ctr.ImageID == imageID {
- matchingContainers = append(matchingContainers, ctr)
- }
- }
- return matchingContainers, nil
-}
-
-// removeMultipleContainers deletes a list of containers from the store
-// TODO refactor this to remove libpod Containers
-func (r *Runtime) removeMultipleContainers(containers []storage.Container) error {
- for _, ctr := range containers {
- if err := r.store.DeleteContainer(ctr.ID); err != nil {
- return errors.Wrapf(err, "could not remove container %q", ctr)
- }
- }
- return nil
-}