Merge pull request #13712 from Luap99/netns-scope-systemd
rootless netns: move process to scope only with systemd
This commit is contained in:
		
						commit
						0cb93e2285
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue