diff options
author | haircommander <pehunt@redhat.com> | 2018-08-20 17:56:35 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-23 18:16:28 +0000 |
commit | 0e6266858a913ac36de0726ede10d5d03af533e3 (patch) | |
tree | 152c7b8b029d5eb80c6caf466c9d0ab1b0ef3913 /cmd | |
parent | 2a7449362f2884d9ae6a783c0ce38979d882e2cf (diff) | |
download | podman-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 'cmd')
-rw-r--r-- | cmd/podman/create.go | 14 | ||||
-rw-r--r-- | cmd/podman/pod_create.go | 6 | ||||
-rw-r--r-- | cmd/podman/pod_ps.go | 2 | ||||
-rw-r--r-- | cmd/podman/shared/pod.go | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index d6bcea7bd..3429c4d97 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -389,7 +389,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim pidModeStr := c.String("pid") if !c.IsSet("pid") && pod != nil && pod.SharesPID() { - pidModeStr = "pod" + pidModeStr = cc.POD } pidMode := container.PidMode(pidModeStr) if !cc.Valid(string(pidMode), pidMode) { @@ -398,7 +398,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim usernsModeStr := c.String("userns") if !c.IsSet("userns") && pod != nil && pod.SharesUser() { - usernsModeStr = "pod" + usernsModeStr = cc.POD } usernsMode := container.UsernsMode(usernsModeStr) if !cc.Valid(string(usernsMode), usernsMode) { @@ -407,7 +407,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim utsModeStr := c.String("uts") if !c.IsSet("uts") && pod != nil && pod.SharesUTS() { - utsModeStr = "pod" + utsModeStr = cc.POD } utsMode := container.UTSMode(utsModeStr) if !cc.Valid(string(utsMode), utsMode) { @@ -416,15 +416,15 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim ipcModeStr := c.String("ipc") if !c.IsSet("ipc") && pod != nil && pod.SharesIPC() { - ipcModeStr = "pod" + ipcModeStr = cc.POD } ipcMode := container.IpcMode(ipcModeStr) if !cc.Valid(string(ipcMode), ipcMode) { return nil, errors.Errorf("--ipc %q is not valid", ipcMode) } - netModeStr := c.String("net") - if !c.IsSet("net") && pod != nil && pod.SharesNet() { - netModeStr = "pod" + netModeStr := c.String("network") + if !c.IsSet("network") && pod != nil && pod.SharesNet() { + netModeStr = cc.POD } // Make sure if network is set to container namespace, port binding is not also being asked for netMode := container.NetworkMode(netModeStr) diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go index eb07e7d50..4eb3126e3 100644 --- a/cmd/podman/pod_create.go +++ b/cmd/podman/pod_create.go @@ -14,7 +14,7 @@ import ( ) var ( - // CRI-O default kernel namespaces + // Kernel namespaces shared by default within a pod DefaultKernelNamespaces = "ipc,net,uts" ) @@ -35,10 +35,12 @@ var podCreateFlags = []cli.Flag{ cli.StringFlag{ Name: "infra-image", Usage: "The image of the infra container to associate with the pod", + Value: libpod.DefaultInfraImage, }, cli.StringFlag{ Name: "infra-command", Usage: "The command to run on the infra container when the pod is started", + Value: libpod.DefaultInfraCommand, }, cli.StringSliceFlag{ Name: "label-file", @@ -58,7 +60,7 @@ var podCreateFlags = []cli.Flag{ }, cli.StringFlag{ Name: "share", - Usage: "A comma deliminated list of kernel namespaces the pod will share", + Usage: "A comma delimited list of kernel namespaces the pod will share", Value: DefaultKernelNamespaces, }, } diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go index 58f404e7a..e03794e7f 100644 --- a/cmd/podman/pod_ps.go +++ b/cmd/podman/pod_ps.go @@ -474,7 +474,7 @@ func getSharedNamespaces(pod *libpod.Pod) []string { if pod.SharesNet() { shared = append(shared, "net") } - if pod.SharesMNT() { + if pod.SharesMount() { shared = append(shared, "mnt") } if pod.SharesIPC() { diff --git a/cmd/podman/shared/pod.go b/cmd/podman/shared/pod.go index 99f9f6031..1a14b3777 100644 --- a/cmd/podman/shared/pod.go +++ b/cmd/podman/shared/pod.go @@ -73,12 +73,10 @@ func GetNamespaceOptions(ns []string) ([]libpod.PodCreateOption, error) { case "net": options = append(options, libpod.WithPodNet()) case "mnt": - //options = append(options, libpod.WithPodMNT()) return erroredOptions, errors.Errorf("Mount sharing functionality not supported on pod level") case "pid": options = append(options, libpod.WithPodPID()) case "user": - // Note: more set up needs to be done before this doesn't error out a create. return erroredOptions, errors.Errorf("User sharing functionality not supported on pod level") case "ipc": options = append(options, libpod.WithPodIPC()) |