diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-11-02 19:35:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 19:35:33 -0400 |
commit | 7bb1d240281e95aeb5eb5f761823e766d2804683 (patch) | |
tree | c03a19ce82df57651218a0133d571c7887ce8b88 /cmd/kpod/spec.go | |
parent | f0f5b51ff27d8eec790f2d5fc12c28c536149bb7 (diff) | |
parent | 6e37df18ef4e2750e954bf64f7dc46d57dcade3a (diff) | |
download | podman-7bb1d240281e95aeb5eb5f761823e766d2804683.tar.gz podman-7bb1d240281e95aeb5eb5f761823e766d2804683.tar.bz2 podman-7bb1d240281e95aeb5eb5f761823e766d2804683.zip |
Merge pull request #6 from rhatdan/papr
Add Papr support
Diffstat (limited to 'cmd/kpod/spec.go')
-rw-r--r-- | cmd/kpod/spec.go | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/cmd/kpod/spec.go b/cmd/kpod/spec.go index 4b05005bd..b6fb8b128 100644 --- a/cmd/kpod/spec.go +++ b/cmd/kpod/spec.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - "github.com/projectatomic/libpod/libpod" - ann "github.com/projectatomic/libpod/pkg/annotations" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "github.com/projectatomic/libpod/libpod" + ann "github.com/projectatomic/libpod/pkg/annotations" "github.com/sirupsen/logrus" "github.com/urfave/cli" "golang.org/x/sys/unix" @@ -15,84 +15,84 @@ import ( // Parses information needed to create a container into an OCI runtime spec func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { - spec := config.GetDefaultLinuxSpec() - spec.Process.Cwd = config.workDir - spec.Process.Args = config.command + configSpec := config.GetDefaultLinuxSpec() + configSpec.Process.Cwd = config.workDir + configSpec.Process.Args = config.command - spec.Process.Terminal = config.tty + configSpec.Process.Terminal = config.tty // User and Group must go together - spec.Process.User.UID = config.user - spec.Process.User.GID = config.group - spec.Process.User.AdditionalGids = config.groupAdd + configSpec.Process.User.UID = config.user + configSpec.Process.User.GID = config.group + configSpec.Process.User.AdditionalGids = config.groupAdd - spec.Process.Env = config.env + configSpec.Process.Env = config.env //TODO // Need examples of capacity additions so I can load that properly - spec.Root.Readonly = config.readOnlyRootfs - spec.Hostname = config.hostname + configSpec.Root.Readonly = config.readOnlyRootfs + configSpec.Hostname = config.hostname // BIND MOUNTS - spec.Mounts = append(spec.Mounts, config.GetVolumeMounts()...) + configSpec.Mounts = append(configSpec.Mounts, config.GetVolumeMounts()...) // TMPFS MOUNTS - spec.Mounts = append(spec.Mounts, config.GetTmpfsMounts()...) + configSpec.Mounts = append(configSpec.Mounts, config.GetTmpfsMounts()...) // RESOURCES - MEMORY - spec.Linux.Sysctl = config.sysctl + configSpec.Linux.Sysctl = config.sysctl if config.resources.memory != 0 { - spec.Linux.Resources.Memory.Limit = &config.resources.memory + configSpec.Linux.Resources.Memory.Limit = &config.resources.memory } if config.resources.memoryReservation != 0 { - spec.Linux.Resources.Memory.Reservation = &config.resources.memoryReservation + configSpec.Linux.Resources.Memory.Reservation = &config.resources.memoryReservation } if config.resources.memorySwap != 0 { - spec.Linux.Resources.Memory.Swap = &config.resources.memorySwap + configSpec.Linux.Resources.Memory.Swap = &config.resources.memorySwap } if config.resources.kernelMemory != 0 { - spec.Linux.Resources.Memory.Kernel = &config.resources.kernelMemory + configSpec.Linux.Resources.Memory.Kernel = &config.resources.kernelMemory } if config.resources.memorySwapiness != 0 { - spec.Linux.Resources.Memory.Swappiness = &config.resources.memorySwapiness + configSpec.Linux.Resources.Memory.Swappiness = &config.resources.memorySwapiness } if config.resources.disableOomKiller { - spec.Linux.Resources.Memory.DisableOOMKiller = &config.resources.disableOomKiller + configSpec.Linux.Resources.Memory.DisableOOMKiller = &config.resources.disableOomKiller } // RESOURCES - CPU if config.resources.cpuShares != 0 { - spec.Linux.Resources.CPU.Shares = &config.resources.cpuShares + configSpec.Linux.Resources.CPU.Shares = &config.resources.cpuShares } if config.resources.cpuQuota != 0 { - spec.Linux.Resources.CPU.Quota = &config.resources.cpuQuota + configSpec.Linux.Resources.CPU.Quota = &config.resources.cpuQuota } if config.resources.cpuPeriod != 0 { - spec.Linux.Resources.CPU.Period = &config.resources.cpuPeriod + configSpec.Linux.Resources.CPU.Period = &config.resources.cpuPeriod } if config.resources.cpuRtRuntime != 0 { - spec.Linux.Resources.CPU.RealtimeRuntime = &config.resources.cpuRtRuntime + configSpec.Linux.Resources.CPU.RealtimeRuntime = &config.resources.cpuRtRuntime } if config.resources.cpuRtPeriod != 0 { - spec.Linux.Resources.CPU.RealtimePeriod = &config.resources.cpuRtPeriod + configSpec.Linux.Resources.CPU.RealtimePeriod = &config.resources.cpuRtPeriod } if config.resources.cpus != "" { - spec.Linux.Resources.CPU.Cpus = config.resources.cpus + configSpec.Linux.Resources.CPU.Cpus = config.resources.cpus } if config.resources.cpusetMems != "" { - spec.Linux.Resources.CPU.Mems = config.resources.cpusetMems + configSpec.Linux.Resources.CPU.Mems = config.resources.cpusetMems } // RESOURCES - PIDS if config.resources.pidsLimit != 0 { - spec.Linux.Resources.Pids.Limit = config.resources.pidsLimit + configSpec.Linux.Resources.Pids.Limit = config.resources.pidsLimit } /* - Capabilities: &spec.LinuxCapabilities{ + Capabilities: &configSpec.LinuxCapabilities{ // Rlimits []PosixRlimit // Where does this come from // Type string // Hard uint64 @@ -102,13 +102,13 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { OOMScoreAdj: &config.resources.oomScoreAdj, // Selinuxlabel }, - Hooks: &spec.Hooks{}, + Hooks: &configSpec.Hooks{}, //Annotations - Resources: &spec.LinuxResources{ + Resources: &configSpec.LinuxResources{ Devices: config.GetDefaultDevices(), BlockIO: &blkio, //HugepageLimits: - Network: &spec.LinuxNetwork{ + Network: &configSpec.LinuxNetwork{ // ClassID *uint32 // Priorites []LinuxInterfacePriority }, @@ -116,7 +116,7 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { //CgroupsPath: //Namespaces: []LinuxNamespace //Devices - Seccomp: &spec.LinuxSeccomp{ + Seccomp: &configSpec.LinuxSeccomp{ // DefaultAction: // Architectures // Syscalls: @@ -129,7 +129,7 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { }, } */ - return &spec, nil + return &configSpec, nil } func (c *createConfig) CreateBlockIO() (spec.LinuxBlockIO, error) { |