diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-09-01 12:51:00 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-09-07 18:18:54 +0000 |
commit | 87f90ce14abf36fbf85f6128b3024ea89a44d670 (patch) | |
tree | 7090c0a491c2f4199f8172e1d30b525fa938ed86 /cmd/podman/parse.go | |
parent | ccc4a339cd124abc668b7542a9eb838cd7d1b214 (diff) | |
download | podman-87f90ce14abf36fbf85f6128b3024ea89a44d670.tar.gz podman-87f90ce14abf36fbf85f6128b3024ea89a44d670.tar.bz2 podman-87f90ce14abf36fbf85f6128b3024ea89a44d670.zip |
Fix pod sharing for utsmode
We should be sharing cgroups namespace by default in pods
uts namespace sharing was broken in pods.
Create a new libpod/pkg/namespaces for handling of namespace fields
in containers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #1418
Approved by: mheon
Diffstat (limited to 'cmd/podman/parse.go')
-rw-r--r-- | cmd/podman/parse.go | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/cmd/podman/parse.go b/cmd/podman/parse.go index 158a006fb..ade592ddf 100644 --- a/cmd/podman/parse.go +++ b/cmd/podman/parse.go @@ -239,50 +239,6 @@ func parseEnvFile(env map[string]string, filename string) error { return scanner.Err() } -// NsIpc represents the container ipc stack. -// for ipc flag -type NsIpc string - -// IsPrivate indicates whether the container uses its private ipc stack. -func (n NsIpc) IsPrivate() bool { - return !(n.IsHost() || n.IsContainer()) -} - -// IsHost indicates whether the container uses the host's ipc stack. -func (n NsIpc) IsHost() bool { - return n == "host" -} - -// IsContainer indicates whether the container uses a container's ipc stack. -func (n NsIpc) IsContainer() bool { - parts := strings.SplitN(string(n), ":", 2) - return len(parts) > 1 && parts[0] == "container" -} - -// Valid indicates whether the ipc stack is valid. -func (n NsIpc) Valid() bool { - parts := strings.Split(string(n), ":") - switch mode := parts[0]; mode { - case "", "host": - case "container": - if len(parts) != 2 || parts[1] == "" { - return false - } - default: - return false - } - return true -} - -// Container returns the name of the container ipc stack is going to be used. -func (n NsIpc) Container() string { - parts := strings.SplitN(string(n), ":", 2) - if len(parts) > 1 { - return parts[1] - } - return "" -} - // validateLabel validates that the specified string is a valid label, and returns it. // Labels are in the form on key=value. // for label flag @@ -313,50 +269,6 @@ func parseLoggingOpts(logDriver string, logDriverOpt []string) (map[string]strin return logOptsMap, nil } -// NsPid represents the pid namespace of the container. -//for pid flag -type NsPid string - -// IsPrivate indicates whether the container uses its own new pid namespace. -func (n NsPid) IsPrivate() bool { - return !(n.IsHost() || n.IsContainer()) -} - -// IsHost indicates whether the container uses the host's pid namespace. -func (n NsPid) IsHost() bool { - return n == "host" -} - -// IsContainer indicates whether the container uses a container's pid namespace. -func (n NsPid) IsContainer() bool { - parts := strings.SplitN(string(n), ":", 2) - return len(parts) > 1 && parts[0] == "container" -} - -// Valid indicates whether the pid namespace is valid. -func (n NsPid) Valid() bool { - parts := strings.Split(string(n), ":") - switch mode := parts[0]; mode { - case "", "host": - case "container": - if len(parts) != 2 || parts[1] == "" { - return false - } - default: - return false - } - return true -} - -// Container returns the name of the container whose pid namespace is going to be used. -func (n NsPid) Container() string { - parts := strings.SplitN(string(n), ":", 2) - if len(parts) > 1 { - return parts[1] - } - return "" -} - // parsePortSpecs receives port specs in the format of ip:public:private/proto and parses // these in to the internal types // for publish, publish-all, and expose flags @@ -567,56 +479,6 @@ func convertKVStringsToMap(values []string) map[string]string { return result } -// NsUser represents userns mode in the container. -// for userns flag -type NsUser string - -// IsHost indicates whether the container uses the host's userns. -func (n NsUser) IsHost() bool { - return n == "host" -} - -// IsPrivate indicates whether the container uses the a private userns. -func (n NsUser) IsPrivate() bool { - return !(n.IsHost()) -} - -// Valid indicates whether the userns is valid. -func (n NsUser) Valid() bool { - parts := strings.Split(string(n), ":") - switch mode := parts[0]; mode { - case "", "host": - default: - return false - } - return true -} - -// NsUts represents the UTS namespace of the container. -// for uts flag -type NsUts string - -// IsPrivate indicates whether the container uses its private UTS namespace. -func (n NsUts) IsPrivate() bool { - return !(n.IsHost()) -} - -// IsHost indicates whether the container uses the host's UTS namespace. -func (n NsUts) IsHost() bool { - return n == "host" -} - -// Valid indicates whether the UTS namespace is valid. -func (n NsUts) Valid() bool { - parts := strings.Split(string(n), ":") - switch mode := parts[0]; mode { - case "", "host": - default: - return false - } - return true -} - // Takes a stringslice and converts to a uint32slice func stringSlicetoUint32Slice(inputSlice []string) ([]uint32, error) { var outputSlice []uint32 |