Ignore failure to set oom_score_adj, as happens in an unprivileged container.
Signed-off-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
parent
45a8f68026
commit
32f24bc3c5
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue