aboutsummaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.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 /libpod/container_internal_linux.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 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 2267f69a1..ba02c9f5a 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -168,91 +168,42 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
}
}
- var podInfraContainer string
- if c.config.Pod != "" {
- pod, err := c.runtime.state.LookupPod(c.config.Pod)
- if err != nil {
- return nil, err
- }
- if pod.SharesNamespaces() {
- if err := pod.updatePod(); err != nil {
- return nil, err
- }
- podInfraContainer = pod.state.InfraContainerID
- }
- }
-
// Add shared namespaces from other containers
if c.config.IPCNsCtr != "" {
if err := c.addNamespaceContainer(&g, IPCNS, c.config.IPCNsCtr, spec.IPCNamespace); err != nil {
return nil, err
}
}
- if c.config.IPCNsPod && podInfraContainer != "" {
- if err := c.addNamespaceContainer(&g, IPCNS, podInfraContainer, spec.IPCNamespace); err != nil {
- return nil, err
- }
- }
if c.config.MountNsCtr != "" {
if err := c.addNamespaceContainer(&g, MountNS, c.config.MountNsCtr, spec.MountNamespace); err != nil {
return nil, err
}
}
- if c.config.MountNsPod && podInfraContainer != "" {
- if err := c.addNamespaceContainer(&g, MountNS, podInfraContainer, spec.MountNamespace); err != nil {
- return nil, err
- }
- }
if c.config.NetNsCtr != "" {
if err := c.addNamespaceContainer(&g, NetNS, c.config.NetNsCtr, spec.NetworkNamespace); err != nil {
return nil, err
}
}
- if c.config.NetNsPod && podInfraContainer != "" {
- if err := c.addNamespaceContainer(&g, NetNS, podInfraContainer, spec.NetworkNamespace); err != nil {
- return nil, err
- }
- }
if c.config.PIDNsCtr != "" {
if err := c.addNamespaceContainer(&g, PIDNS, c.config.PIDNsCtr, string(spec.PIDNamespace)); err != nil {
return nil, err
}
}
- if c.config.PIDNsPod && podInfraContainer != "" {
- if err := c.addNamespaceContainer(&g, PIDNS, podInfraContainer, string(spec.PIDNamespace)); err != nil {
- return nil, err
- }
- }
if c.config.UserNsCtr != "" {
if err := c.addNamespaceContainer(&g, UserNS, c.config.UserNsCtr, spec.UserNamespace); err != nil {
return nil, err
}
}
- if c.config.UserNsPod && podInfraContainer != "" {
- if err := c.addNamespaceContainer(&g, UserNS, podInfraContainer, spec.UserNamespace); err != nil {
- return nil, err
- }
- }
if c.config.UTSNsCtr != "" {
if err := c.addNamespaceContainer(&g, UTSNS, c.config.UTSNsCtr, spec.UTSNamespace); err != nil {
return nil, err
}
}
- if c.config.UTSNsPod && podInfraContainer != "" {
- if err := c.addNamespaceContainer(&g, UTSNS, podInfraContainer, spec.UTSNamespace); err != nil {
- return nil, err
- }
- }
if c.config.CgroupNsCtr != "" {
if err := c.addNamespaceContainer(&g, CgroupNS, c.config.CgroupNsCtr, spec.CgroupNamespace); err != nil {
return nil, err
}
}
- if c.config.CgroupNsPod && podInfraContainer != "" {
- if err := c.addNamespaceContainer(&g, CgroupNS, podInfraContainer, spec.CgroupNamespace); err != nil {
- return nil, err
- }
- }
if c.config.Rootfs == "" {
if err := idtools.MkdirAllAs(c.state.RealMountpoint, 0700, c.RootUID(), c.RootGID()); err != nil {