summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-04 13:19:35 -0400
committerGitHub <noreply@github.com>2022-04-04 13:19:35 -0400
commit4f31ade2b251514992dec7cfe9444dd0c62f00b5 (patch)
treeb71846639dc1c0d2b3206c26afbf0fb9f8b507c5 /cmd
parentaecb2023d240b69690f35721efcee7d724eba3f5 (diff)
parent164b64ea3baa8502a23fc0c7674f4a7e60507aa0 (diff)
downloadpodman-4f31ade2b251514992dec7cfe9444dd0c62f00b5.tar.gz
podman-4f31ade2b251514992dec7cfe9444dd0c62f00b5.tar.bz2
podman-4f31ade2b251514992dec7cfe9444dd0c62f00b5.zip
Merge pull request #13765 from giuseppe/do-not-set-oom-score-adj
specgen: do not set OOMScoreAdj by default
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/common/create.go3
-rw-r--r--cmd/podman/common/create_opts.go2
-rw-r--r--cmd/podman/containers/create.go7
3 files changed, 9 insertions, 3 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index afaa1942e..8a3f02036 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -348,8 +348,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
)
oomScoreAdjFlagName := "oom-score-adj"
- createFlags.IntVar(
- &cf.OOMScoreAdj,
+ createFlags.Int(
oomScoreAdjFlagName, 0,
"Tune the host's OOM preferences (-1000 to 1000)",
)
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index e5a2a0da3..ad6b3870a 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -286,7 +286,7 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, rtc *c
LogDriver: cc.HostConfig.LogConfig.Type,
LogOptions: stringMaptoArray(cc.HostConfig.LogConfig.Config),
Name: cc.Name,
- OOMScoreAdj: cc.HostConfig.OomScoreAdj,
+ OOMScoreAdj: &cc.HostConfig.OomScoreAdj,
Arch: "",
OS: "",
Variant: "",
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index de1a41e25..bbc449a1e 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -238,6 +238,13 @@ func CreateInit(c *cobra.Command, vals entities.ContainerCreateOptions, isInfra
vals.GroupAdd = groups
}
+ if c.Flags().Changed("oom-score-adj") {
+ val, err := c.Flags().GetInt("oom-score-adj")
+ if err != nil {
+ return vals, err
+ }
+ vals.OOMScoreAdj = &val
+ }
if c.Flags().Changed("pids-limit") {
val := c.Flag("pids-limit").Value.String()
// Convert -1 to 0, so that -1 maps to unlimited pids limit