aboutsummaryrefslogtreecommitdiff
path: root/cmd/kpod/create.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/create.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/create.go')
-rw-r--r--cmd/kpod/create.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/cmd/kpod/create.go b/cmd/kpod/create.go
index d609d011e..9e4162993 100644
--- a/cmd/kpod/create.go
+++ b/cmd/kpod/create.go
@@ -35,8 +35,8 @@ var (
)
type createResourceConfig struct {
- blkioDevice []string // blkio-weight-device
blkioWeight uint16 // blkio-weight
+ blkioWeightDevice []string // blkio-weight-device
cpuPeriod uint64 // cpu-period
cpuQuota int64 // cpu-quota
cpuRtPeriod uint64 // cpu-rt-period
@@ -46,15 +46,15 @@ type createResourceConfig struct {
cpusetCpus string
cpusetMems string // cpuset-mems
deviceReadBps []string // device-read-bps
- deviceReadIops []string // device-read-iops
+ deviceReadIOps []string // device-read-iops
deviceWriteBps []string // device-write-bps
- deviceWriteIops []string // device-write-iops
+ deviceWriteIOps []string // device-write-iops
disableOomKiller bool // oom-kill-disable
kernelMemory int64 // kernel-memory
memory int64 //memory
memoryReservation int64 // memory-reservation
memorySwap int64 //memory-swap
- memorySwapiness uint64 // memory-swappiness
+ memorySwappiness int // memory-swappiness
oomScoreAdj int //oom-score-adj
pidsLimit int64 // pids-limit
shmSize string
@@ -373,7 +373,7 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er
readOnlyRootfs: c.Bool("read-only"),
resources: createResourceConfig{
blkioWeight: blkioWeight,
- blkioDevice: c.StringSlice("blkio-weight-device"),
+ blkioWeightDevice: c.StringSlice("blkio-weight-device"),
cpuShares: c.Uint64("cpu-shares"),
cpuPeriod: c.Uint64("cpu-period"),
cpusetCpus: c.String("cpu-period"),
@@ -383,15 +383,15 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er
cpuRtRuntime: c.Int64("cpu-rt-runtime"),
cpus: c.String("cpus"),
deviceReadBps: c.StringSlice("device-read-bps"),
- deviceReadIops: c.StringSlice("device-read-iops"),
+ deviceReadIOps: c.StringSlice("device-read-iops"),
deviceWriteBps: c.StringSlice("device-write-bps"),
- deviceWriteIops: c.StringSlice("device-write-iops"),
+ deviceWriteIOps: c.StringSlice("device-write-iops"),
disableOomKiller: c.Bool("oom-kill-disable"),
shmSize: c.String("shm-size"),
memory: memoryLimit,
memoryReservation: memoryReservation,
memorySwap: memorySwap,
- memorySwapiness: c.Uint64("memory-swapiness"),
+ memorySwappiness: c.Int("memory-swappiness"),
kernelMemory: memoryKernel,
oomScoreAdj: c.Int("oom-score-adj"),
@@ -418,6 +418,12 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er
return nil, err
}
}
-
+ warnings, err := verifyContainerResources(config, false)
+ if err != nil {
+ return nil, err
+ }
+ for _, warning := range warnings {
+ fmt.Fprintln(os.Stderr, warning)
+ }
return config, nil
}