summaryrefslogtreecommitdiff
path: root/pkg/spec/createconfig.go
diff options
context:
space:
mode:
authorhaircommander <pehunt@redhat.com>2018-08-20 17:56:35 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-23 18:16:28 +0000
commit0e6266858a913ac36de0726ede10d5d03af533e3 (patch)
tree152c7b8b029d5eb80c6caf466c9d0ab1b0ef3913 /pkg/spec/createconfig.go
parent2a7449362f2884d9ae6a783c0ce38979d882e2cf (diff)
downloadpodman-0e6266858a913ac36de0726ede10d5d03af533e3.tar.gz
podman-0e6266858a913ac36de0726ede10d5d03af533e3.tar.bz2
podman-0e6266858a913ac36de0726ede10d5d03af533e3.zip
Fixing network ns segfault
As well as small style corrections, update pod_top_test to use CreatePod, and move handling of adding a container to the pod's namespace from container_internal_linux to libpod/option. Signed-off-by: haircommander <pehunt@redhat.com> Closes: #1187 Approved by: mheon
Diffstat (limited to 'pkg/spec/createconfig.go')
-rw-r--r--pkg/spec/createconfig.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index dd1cd5833..6a7ddc1ae 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -309,6 +309,7 @@ func createExitCommand(runtime *libpod.Runtime) []string {
func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]libpod.CtrCreateOption, error) {
var options []libpod.CtrCreateOption
var portBindings []ocicni.PortMapping
+ var pod *libpod.Pod
var err error
// Uncomment after talking to mheon about unimplemented funcs
@@ -323,7 +324,7 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib
}
if c.Pod != "" {
logrus.Debugf("adding container to pod %s", c.Pod)
- pod, err := runtime.LookupPod(c.Pod)
+ pod, err = runtime.LookupPod(c.Pod)
if err != nil {
return nil, errors.Wrapf(err, "unable to add container to pod %s", c.Pod)
}
@@ -385,7 +386,7 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib
}
options = append(options, libpod.WithNetNSFrom(connectedCtr))
} else if IsPod(string(c.NetMode)) {
- options = append(options, libpod.WithNetNSFromPod())
+ options = append(options, libpod.WithNetNSFromPod(pod))
} else if !c.NetMode.IsHost() && !c.NetMode.IsNone() {
isRootless := rootless.IsRootless()
postConfigureNetNS := isRootless || (len(c.IDMappings.UIDMap) > 0 || len(c.IDMappings.GIDMap) > 0) && !c.UsernsMode.IsHost()
@@ -404,7 +405,7 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib
options = append(options, libpod.WithPIDNSFrom(connectedCtr))
}
if IsPod(string(c.PidMode)) {
- options = append(options, libpod.WithPIDNSFromPod())
+ options = append(options, libpod.WithPIDNSFromPod(pod))
}
if c.IpcMode.IsContainer() {
@@ -416,11 +417,11 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib
options = append(options, libpod.WithIPCNSFrom(connectedCtr))
}
if IsPod(string(c.IpcMode)) {
- options = append(options, libpod.WithIPCNSFromPod())
+ options = append(options, libpod.WithIPCNSFromPod(pod))
}
if IsPod(string(c.UtsMode)) {
- options = append(options, libpod.WithUTSNSFromPod())
+ options = append(options, libpod.WithUTSNSFromPod(pod))
}
// TODO: MNT, USER, CGROUP