diff options
author | Matthew Heon <mheon@redhat.com> | 2019-11-11 14:36:00 -0500 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2019-11-19 15:38:03 -0500 |
commit | 6c405b5fbcc83ba49c187087eb4e1ccc1a7ff147 (patch) | |
tree | 103cce9e68af6bf26aef6031660e3d20e2236f90 | |
parent | 25cc43c376c5ddfa70a6009526f8f03b5235c2c6 (diff) | |
download | podman-6c405b5fbcc83ba49c187087eb4e1ccc1a7ff147.tar.gz podman-6c405b5fbcc83ba49c187087eb4e1ccc1a7ff147.tar.bz2 podman-6c405b5fbcc83ba49c187087eb4e1ccc1a7ff147.zip |
Error on netns not exist only when ctr is running
If the container is running and we need to get its netns and
can't, that is a serious bug deserving of errors.
If it's not running, that's not really a big deal. Log an error
and continue.
Signed-off-by: Matthew Heon <mheon@redhat.com>
-rw-r--r-- | libpod/boltdb_state_linux.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/boltdb_state_linux.go b/libpod/boltdb_state_linux.go index 09a9be606..6ccda71bd 100644 --- a/libpod/boltdb_state_linux.go +++ b/libpod/boltdb_state_linux.go @@ -3,6 +3,8 @@ package libpod import ( + "github.com/containers/libpod/libpod/define" + "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -25,8 +27,12 @@ func replaceNetNS(netNSPath string, ctr *Container, newState *ContainerState) er if err == nil { newState.NetNS = ns } else { + if ctr.ensureState(define.ContainerStateRunning, define.ContainerStatePaused) { + return errors.Wrapf(err, "error joning network namespace of container %s", ctr.ID()) + } + logrus.Errorf("error joining network namespace for container %s: %v", ctr.ID(), err) - ctr.valid = false + ctr.state.NetNS = nil } } } else { |