diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-29 04:26:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-29 04:26:30 -0700 |
commit | 6ab27c6355a4df228ed6d527162d5251d867b9b3 (patch) | |
tree | 98aff18fca2369cd87219aef0d18db872a67047d /pkg/spec | |
parent | fdf979a7917a497322b23354778bd32bbd9b05f5 (diff) | |
parent | e25924f31c8e9e53490f02073ba69d41e3470712 (diff) | |
download | podman-6ab27c6355a4df228ed6d527162d5251d867b9b3.tar.gz podman-6ab27c6355a4df228ed6d527162d5251d867b9b3.tar.bz2 podman-6ab27c6355a4df228ed6d527162d5251d867b9b3.zip |
Merge pull request #2796 from mheon/fix_cni_multinetwork
Ensure that we make a netns for CNI non-default nets
Diffstat (limited to 'pkg/spec')
-rw-r--r-- | pkg/spec/createconfig.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index 07ae633d1..0a12e3dca 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -451,16 +451,15 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime, pod *l } } - if IsNS(string(c.NetMode)) { - split := strings.SplitN(string(c.NetMode), ":", 2) - if len(split[0]) != 2 { - return nil, errors.Errorf("invalid user defined network namespace %q", c.NetMode.UserDefined()) + if c.NetMode.IsNS() { + ns := c.NetMode.NS() + if ns == "" { + return nil, errors.Errorf("invalid empty user-defined network namespace") } - _, err := os.Stat(split[1]) + _, err := os.Stat(ns) if err != nil { return nil, err } - options = append(options, libpod.WithNetNS(portBindings, false, string(c.NetMode), networks)) } else if c.NetMode.IsContainer() { connectedCtr, err := c.Runtime.LookupContainer(c.NetMode.Container()) if err != nil { |