diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2019-02-06 06:20:47 -0800 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2019-02-06 06:22:13 -0800 |
commit | 3416bb20f27ab554ef9fcbe9830c30eba169171c (patch) | |
tree | 643a6171abadc42ae9a4334fb1a65fbbe3219d5a /pkg | |
parent | d321c5d942f85b56852532edfd225dcdd591f817 (diff) | |
download | podman-3416bb20f27ab554ef9fcbe9830c30eba169171c.tar.gz podman-3416bb20f27ab554ef9fcbe9830c30eba169171c.tar.bz2 podman-3416bb20f27ab554ef9fcbe9830c30eba169171c.zip |
Fix handling of memory limits via varlink
Currently handlin memory via varlink is hard coded to 0
Changing to
Memory: create.Resources.Memory,
MemoryReservation: create.Resources.Memory_reservation,
MemorySwap: create.Resources.Memory_swap,
MemorySwappiness: int(create.Resources.Memory_swappiness),
KernelMemory: create.Resources.Kernel_memory,
Allows callers to modify these memory settings.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg')
-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, |