diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-02-06 16:51:05 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2018-02-08 06:42:21 -0500 |
commit | 3921f10a729054c23296f392b0f271c1ac5e5770 (patch) | |
tree | b129bb402157b23eb4f8228818cc94d87b9fd88b /libpod/container_api.go | |
parent | 8fdccb77648f5b772c6bae98fce4734b1a54ed4a (diff) | |
download | podman-3921f10a729054c23296f392b0f271c1ac5e5770.tar.gz podman-3921f10a729054c23296f392b0f271c1ac5e5770.tar.bz2 podman-3921f10a729054c23296f392b0f271c1ac5e5770.zip |
cleanup network stack as well as storage when container shuts down.
This patch will cleanup the network stack when the container exits
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r-- | libpod/container_api.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 3693ab78b..72df60eb8 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -694,8 +694,9 @@ func (c *Container) Wait() (int32, error) { return exitCode, nil } -// CleanupStorage unmounts all mount points in container and cleans up container storage -func (c *Container) CleanupStorage() error { +// Cleanup unmounts all mount points in container and cleans up container storage +// It also cleans up the network stack +func (c *Container) Cleanup() error { if !c.locked { c.lock.Lock() defer c.lock.Unlock() @@ -703,6 +704,12 @@ func (c *Container) CleanupStorage() error { return err } } + + // Stop the container's network namespace (if it has one) + if err := c.cleanupNetwork(); err != nil { + logrus.Errorf("unable cleanup network for container %s: %q", c.ID(), err) + } + return c.cleanupStorage() } |