diff options
author | cdoern <cdoern@redhat.com> | 2022-06-13 15:35:16 -0400 |
---|---|---|
committer | Charlie Doern <cdoern@redhat.com> | 2022-06-24 15:39:15 -0400 |
commit | 2792e598c7ce1198ec8464a3119504123ae8397c (patch) | |
tree | 0d8a1ca5428822278a43cb990308a9f960e08e1e /pkg/specgen/generate/container_create.go | |
parent | 95707a08bf49141ceb782b28adc947dda213f300 (diff) | |
download | podman-2792e598c7ce1198ec8464a3119504123ae8397c.tar.gz podman-2792e598c7ce1198ec8464a3119504123ae8397c.tar.bz2 podman-2792e598c7ce1198ec8464a3119504123ae8397c.zip |
podman cgroup enhancement
currently, setting any sort of resource limit in a pod does nothing. With the newly refactored creation process in c/common, podman ca now set resources at a pod level
meaning that resource related flags can now be exposed to podman pod create.
cgroupfs and systemd are both supported with varying completion. cgroupfs is a much simpler process and one that is virtually complete for all resource types, the flags now just need to be added. systemd on the other hand
has to be handeled via the dbus api meaning that the limits need to be passed as recognized properties to systemd. The properties added so far are the ones that podman pod create supports as well as `cpuset-mems` as this will
be the next flag I work on.
Signed-off-by: Charlie Doern <cdoern@redhat.com>
Diffstat (limited to 'pkg/specgen/generate/container_create.go')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 0dec943d1..6b2e90b22 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -180,10 +180,23 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener if err != nil { return nil, nil, nil, err } + resources := runtimeSpec.Linux.Resources + + // resources get overwrritten similarly to pod inheritance, manually assign here if there is a new value + marshalRes, err := json.Marshal(resources) + if err != nil { + return nil, nil, nil, err + } + err = json.Unmarshal(out, runtimeSpec.Linux) if err != nil { return nil, nil, nil, err } + + err = json.Unmarshal(marshalRes, runtimeSpec.Linux.Resources) + if err != nil { + return nil, nil, nil, err + } } if s.ResourceLimits != nil { switch { |