Ignore failure to set oom_score_adj, as happens in an unprivileged container.
Signed-off-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Upstream-commit: 32f24bc3c59af530196d3613dcb55ffced964de4 Component: engine
This commit is contained in:
@@ -1148,6 +1148,11 @@ func setupOOMScoreAdj(score int) error {
|
||||
return err
|
||||
}
|
||||
_, err = f.WriteString(strconv.Itoa(score))
|
||||
if os.IsPermission(err) {
|
||||
// Setting oom_score_adj does not work in an
|
||||
// unprivileged container. Ignore the error.
|
||||
return nil
|
||||
}
|
||||
f.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -435,6 +435,11 @@ func setOOMScore(pid, score int) error {
|
||||
}
|
||||
_, err = f.WriteString(strconv.Itoa(score))
|
||||
f.Close()
|
||||
if os.IsPermission(err) {
|
||||
// Setting oom_score_adj does not work in an
|
||||
// unprivileged container. Ignore the error.
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user