aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-03-30 10:23:19 -0400
committerGitHub <noreply@github.com>2022-03-30 10:23:19 -0400
commit0cb93e22856788ee7cfcfaabe8434753c25408b6 (patch)
treed90edf837fc14e2b30a42693b1221534559b4c8b /libpod
parentff8834f0232f128b781ec23d66a5676da0670847 (diff)
parent1f1cf7bd408b763f0297ab327f2f623695e3373f (diff)
downloadpodman-0cb93e22856788ee7cfcfaabe8434753c25408b6.tar.gz
podman-0cb93e22856788ee7cfcfaabe8434753c25408b6.tar.bz2
podman-0cb93e22856788ee7cfcfaabe8434753c25408b6.zip
Merge pull request #13712 from Luap99/netns-scope-systemd
rootless netns: move process to scope only with systemd
Diffstat (limited to 'libpod')
-rw-r--r--libpod/networking_linux.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index db36ac75d..71e29f18f 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -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