aboutsummaryrefslogtreecommitdiff
path: root/libpod/networking.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2017-12-06 16:43:23 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-14 23:59:21 +0000
commitff9c965335af0258bd34edae31699a87a03689a9 (patch)
tree71e308867fe885a2c94181e8631c9c9cf8793f7d /libpod/networking.go
parent0ff92f8e20edb46eb8a9d82b929e153bcdaa3044 (diff)
downloadpodman-ff9c965335af0258bd34edae31699a87a03689a9.tar.gz
podman-ff9c965335af0258bd34edae31699a87a03689a9.tar.bz2
podman-ff9c965335af0258bd34edae31699a87a03689a9.zip
Create new network namespaces when initializing containers
Also fix a few lingering lint issues Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #109 Approved by: mheon
Diffstat (limited to 'libpod/networking.go')
-rw-r--r--libpod/networking.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/libpod/networking.go b/libpod/networking.go
index f613ad5f8..24e6339d7 100644
--- a/libpod/networking.go
+++ b/libpod/networking.go
@@ -20,19 +20,19 @@ func getPodNetwork(id, name, nsPath string, ports []ocicni.PortMapping) ocicni.P
// Create and configure a new network namespace for a container
func (r *Runtime) createNetNS(ctr *Container) (err error) {
- ns, err := ns.NewNS()
+ ctrNS, err := ns.NewNS()
if err != nil {
return errors.Wrapf(err, "error creating network namespace for container %s", ctr.ID())
}
defer func() {
if err != nil {
- if err2 := ns.Close(); err2 != nil {
+ if err2 := ctrNS.Close(); err2 != nil {
logrus.Errorf("Error closing partially created network namespace for container %s: %v", ctr.ID(), err2)
}
}
}()
- podNetwork := getPodNetwork(ctr.ID(), ctr.Name(), ns.Path(), ctr.config.PortMappings)
+ podNetwork := getPodNetwork(ctr.ID(), ctr.Name(), ctrNS.Path(), ctr.config.PortMappings)
if err := r.netPlugin.SetUpPod(podNetwork); err != nil {
return errors.Wrapf(err, "error configuring network namespace for container %s", ctr.ID())
@@ -40,7 +40,7 @@ func (r *Runtime) createNetNS(ctr *Container) (err error) {
// TODO hostport mappings for forwarded ports
- ctr.state.NetNS = ns
+ ctr.state.NetNS = ctrNS
return nil
}