Skip to content

Commit

Permalink
Merge pull request #13712 from Luap99/netns-scope-systemd
Browse files Browse the repository at this point in the history
rootless netns: move process to scope only with systemd
  • Loading branch information
openshift-merge-robot authored Mar 30, 2022
2 parents ff8834f + 1f1cf7b commit 0cb93e2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions libpod/networking_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,13 @@ func (r *Runtime) GetRootlessNetNs(new bool) (*RootlessNetNS, error) {
return nil, err
}

// move to systemd scope to prevent systemd from killing it
err = utils.MoveRootlessNetnsSlirpProcessToUserSlice(cmd.Process.Pid)
if err != nil {
logrus.Errorf("failed to move the rootless netns slirp4netns process to the systemd user.slice: %v", err)
if utils.RunsOnSystemd() {
// move to systemd scope to prevent systemd from killing it
err = utils.MoveRootlessNetnsSlirpProcessToUserSlice(cmd.Process.Pid)
if err != nil {
// only log this, it is not fatal but can lead to issues when running podman inside systemd units
logrus.Errorf("failed to move the rootless netns slirp4netns process to the systemd user.slice: %v", err)
}
}

// build a new resolv.conf file which uses the slirp4netns dns server address
Expand Down

0 comments on commit 0cb93e2

Please sign in to comment.