diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-07 00:34:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-07 00:34:59 +0100 |
commit | dab590d13eddf705f1a088e4a1afceaf0f15bfbb (patch) | |
tree | c493234c31dd3b1605bb649c8620c82ed7c82dcd | |
parent | 0cf9747cf4fae160f1335395c41595461fdb4866 (diff) | |
parent | 3416bb20f27ab554ef9fcbe9830c30eba169171c (diff) | |
download | podman-dab590d13eddf705f1a088e4a1afceaf0f15bfbb.tar.gz podman-dab590d13eddf705f1a088e4a1afceaf0f15bfbb.tar.bz2 podman-dab590d13eddf705f1a088e4a1afceaf0f15bfbb.zip |
Merge pull request #2278 from rhatdan/varlink
Fix handling of memory limits via varlink
-rw-r--r-- | pkg/varlinkapi/containers_create.go | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/pkg/varlinkapi/containers_create.go b/pkg/varlinkapi/containers_create.go index cc707b11f..f1835a189 100644 --- a/pkg/varlinkapi/containers_create.go +++ b/pkg/varlinkapi/containers_create.go @@ -68,17 +68,11 @@ func (i *LibpodAPI) CreateContainer(call iopodman.VarlinkCall, config iopodman.C // varlinkCreateToCreateConfig takes the varlink input struct and maps it to a pointer // of a CreateConfig, which eventually can be used to create the OCI spec. func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, runtime *libpod.Runtime, imageName string, data *inspect.ImageData) (*cc.CreateConfig, error) { - var ( - inputCommand, command []string - memoryLimit, memoryReservation, memorySwap, memoryKernel int64 - blkioWeight uint16 - ) - idmappings, err := util.ParseIDMapping(create.Uidmap, create.Gidmap, create.Subuidname, create.Subgidname) if err != nil { return nil, err } - inputCommand = create.Command + inputCommand := create.Command entrypoint := create.Entrypoint // ENTRYPOINT @@ -92,9 +86,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru } // Build the command // If we have an entry point, it goes first - if len(entrypoint) > 0 { - command = entrypoint - } + command := entrypoint if len(inputCommand) > 0 { // User command overrides data CMD command = append(command, inputCommand...) @@ -103,10 +95,6 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru command = append(command, data.Config.Cmd...) } - if create.Resources.Blkio_weight != 0 { - blkioWeight = uint16(create.Resources.Blkio_weight) - } - stopSignal := syscall.SIGTERM if create.Stop_signal > 0 { stopSignal, err = signal.ParseSignal(fmt.Sprintf("%d", create.Stop_signal)) @@ -183,7 +171,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru Quiet: create.Quiet, ReadOnlyRootfs: create.Readonly_rootfs, Resources: cc.CreateResourceConfig{ - BlkioWeight: blkioWeight, + BlkioWeight: uint16(create.Resources.Blkio_weight), BlkioWeightDevice: create.Resources.Blkio_weight_device, CPUShares: uint64(create.Resources.Cpu_shares), CPUPeriod: uint64(create.Resources.Cpu_period), @@ -199,11 +187,11 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru DeviceWriteIOps: create.Resources.Device_write_iops, DisableOomKiller: create.Resources.Disable_oomkiller, ShmSize: create.Resources.Shm_size, - Memory: memoryLimit, - MemoryReservation: memoryReservation, - MemorySwap: memorySwap, + Memory: create.Resources.Memory, + MemoryReservation: create.Resources.Memory_reservation, + MemorySwap: create.Resources.Memory_swap, MemorySwappiness: int(create.Resources.Memory_swappiness), - KernelMemory: memoryKernel, + KernelMemory: create.Resources.Kernel_memory, OomScoreAdj: int(create.Resources.Oom_score_adj), PidsLimit: create.Resources.Pids_limit, Ulimit: create.Resources.Ulimit, |