summaryrefslogtreecommitdiff
path: root/cmd/kpod/spec.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-11-22 07:57:31 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-22 20:53:15 +0000
commit195d48d86d871f531d72e0669ea96d315845da35 (patch)
tree8d1aaf245b769a4f9ef666f3a9b794273c7247a0 /cmd/kpod/spec.go
parentc344fe61c11beaf687da284f71bde2311b91371d (diff)
downloadpodman-195d48d86d871f531d72e0669ea96d315845da35.tar.gz
podman-195d48d86d871f531d72e0669ea96d315845da35.tar.bz2
podman-195d48d86d871f531d72e0669ea96d315845da35.zip
Copy some verification code out of Docker to verify user input
Added lots of verification code to make sure resourses asociated with containers is correct. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #60 Approved by: umohnani8
Diffstat (limited to 'cmd/kpod/spec.go')
-rw-r--r--cmd/kpod/spec.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd/kpod/spec.go b/cmd/kpod/spec.go
index 752827669..0a99d792b 100644
--- a/cmd/kpod/spec.go
+++ b/cmd/kpod/spec.go
@@ -142,8 +142,8 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) {
if config.resources.kernelMemory != 0 {
g.SetLinuxResourcesMemoryKernel(config.resources.kernelMemory)
}
- if config.resources.memorySwapiness != 0 {
- g.SetLinuxResourcesMemorySwappiness(config.resources.memorySwapiness)
+ if config.resources.memorySwappiness != -1 {
+ g.SetLinuxResourcesMemorySwappiness(uint64(config.resources.memorySwappiness))
}
g.SetLinuxResourcesMemoryDisableOOMKiller(config.resources.disableOomKiller)
g.SetProcessOOMScoreAdj(config.resources.oomScoreAdj)
@@ -263,9 +263,9 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) {
func (c *createConfig) CreateBlockIO() (spec.LinuxBlockIO, error) {
bio := spec.LinuxBlockIO{}
bio.Weight = &c.resources.blkioWeight
- if len(c.resources.blkioDevice) > 0 {
+ if len(c.resources.blkioWeightDevice) > 0 {
var lwds []spec.LinuxWeightDevice
- for _, i := range c.resources.blkioDevice {
+ for _, i := range c.resources.blkioWeightDevice {
wd, err := validateweightDevice(i)
if err != nil {
return bio, errors.Wrapf(err, "invalid values for blkio-weight-device")
@@ -293,19 +293,19 @@ func (c *createConfig) CreateBlockIO() (spec.LinuxBlockIO, error) {
}
bio.ThrottleWriteBpsDevice = writeBpds
}
- if len(c.resources.deviceReadIops) > 0 {
- readIops, err := makeThrottleArray(c.resources.deviceReadIops)
+ if len(c.resources.deviceReadIOps) > 0 {
+ readIOps, err := makeThrottleArray(c.resources.deviceReadIOps)
if err != nil {
return bio, err
}
- bio.ThrottleReadIOPSDevice = readIops
+ bio.ThrottleReadIOPSDevice = readIOps
}
- if len(c.resources.deviceWriteIops) > 0 {
- writeIops, err := makeThrottleArray(c.resources.deviceWriteIops)
+ if len(c.resources.deviceWriteIOps) > 0 {
+ writeIOps, err := makeThrottleArray(c.resources.deviceWriteIOps)
if err != nil {
return bio, err
}
- bio.ThrottleWriteIOPSDevice = writeIops
+ bio.ThrottleWriteIOPSDevice = writeIOps
}
return bio, nil