summaryrefslogtreecommitdiff
path: root/libpod/networking.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-02 11:10:37 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-02 19:20:26 +0000
commitedb1609c6121a550a3c882529e44387c217d2b03 (patch)
treed533567351dd70b8bcffe17174a8edc1fefa199d /libpod/networking.go
parent29d650a3799b76b08094b6dc90fe8500c76fa6de (diff)
downloadpodman-edb1609c6121a550a3c882529e44387c217d2b03.tar.gz
podman-edb1609c6121a550a3c882529e44387c217d2b03.tar.bz2
podman-edb1609c6121a550a3c882529e44387c217d2b03.zip
Update DB to hold CNI network information
Replace our old IP and Subnet fields in state with CNI types that contain a lot more information. Retrieve these structs from the CNI plugins themselves. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #440 Approved by: baude
Diffstat (limited to 'libpod/networking.go')
-rw-r--r--libpod/networking.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/networking.go b/libpod/networking.go
index 40756cf88..f92b80201 100644
--- a/libpod/networking.go
+++ b/libpod/networking.go
@@ -3,6 +3,7 @@ package libpod
import (
"net"
+ cnitypes "github.com/containernetworking/cni/pkg/types/current"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/pkg/errors"
@@ -37,12 +38,17 @@ func (r *Runtime) createNetNS(ctr *Container) (err error) {
logrus.Debugf("Made network namespace at %s for container %s", ctrNS.Path(), ctr.ID())
podNetwork := getPodNetwork(ctr.ID(), ctr.Name(), ctrNS.Path(), ctr.config.PortMappings)
- _, err = r.netPlugin.SetUpPod(podNetwork)
+ result, err := r.netPlugin.SetUpPod(podNetwork)
if err != nil {
return errors.Wrapf(err, "error configuring network namespace for container %s", ctr.ID())
}
+ resultStruct := result.(*cnitypes.Result)
+ logrus.Debugf("Response from CNI plugins: %v", resultStruct.String())
+
ctr.state.NetNS = ctrNS
+ ctr.state.IPs = resultStruct.IPs
+ ctr.state.Routes = resultStruct.Routes
return nil
}