diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-11 21:35:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-11 21:35:37 +0200 |
commit | 2b64f8844655b7188332a404ec85d32c33feb9e9 (patch) | |
tree | afcbaa55ba396ac68ebdc87ad15f1554e6ee1e5d /pkg/spec/spec.go | |
parent | 24409daa36137406a403ae8e22cf71afa590c746 (diff) | |
parent | fb88074e68db25474290535e8a778e39434cc2a2 (diff) | |
download | podman-2b64f8844655b7188332a404ec85d32c33feb9e9.tar.gz podman-2b64f8844655b7188332a404ec85d32c33feb9e9.tar.bz2 podman-2b64f8844655b7188332a404ec85d32c33feb9e9.zip |
Merge pull request #3491 from giuseppe/rlimit-host
podman: add --ulimit host
Diffstat (limited to 'pkg/spec/spec.go')
-rw-r--r-- | pkg/spec/spec.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index 5cc021bf5..d44beb3e4 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -20,6 +20,12 @@ import ( const cpuPeriod = 100000 +type systemUlimit struct { + name string + max uint64 + cur uint64 +} + func getAvailableGids() (int64, error) { idMap, err := user.ParseIDMapFile("/proc/self/gid_map") if err != nil { @@ -557,6 +563,20 @@ func addRlimits(config *CreateConfig, g *generate.Generator) error { ) for _, u := range config.Resources.Ulimit { + if u == "host" { + if len(config.Resources.Ulimit) != 1 { + return errors.New("ulimit can use host only once") + } + hostLimits, err := getHostRlimits() + if err != nil { + return err + } + for _, i := range hostLimits { + g.AddProcessRlimits(i.name, i.max, i.cur) + } + break + } + ul, err := units.ParseUlimit(u) if err != nil { return errors.Wrapf(err, "ulimit option %q requires name=SOFT:HARD, failed to be parsed", u) |