mirror of
https://github.com/containers/podman.git
synced 2025-10-18 03:33:32 +08:00
Add support for containers.conf
vendor in c/common config pkg for containers.conf Signed-off-by: Qi Wang qiwan@redhat.com Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -148,7 +148,7 @@ func (r *Runtime) createNetNS(ctr *Container) (n ns.NetNS, q []*cnitypes.Result,
|
||||
logrus.Debugf("Made network namespace at %s for container %s", ctrNS.Path(), ctr.ID())
|
||||
|
||||
networkStatus := []*cnitypes.Result{}
|
||||
if !rootless.IsRootless() && ctr.config.NetMode != "slirp4netns" {
|
||||
if !rootless.IsRootless() && !ctr.config.NetMode.IsSlirp4netns() {
|
||||
networkStatus, err = r.configureNetNS(ctr, ctrNS)
|
||||
}
|
||||
return ctrNS, networkStatus, err
|
||||
@ -177,7 +177,7 @@ func checkSlirpFlags(path string) (*slirpFeatures, error) {
|
||||
|
||||
// Configure the network namespace for a rootless container
|
||||
func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) {
|
||||
path := r.config.NetworkCmdPath
|
||||
path := r.config.Engine.NetworkCmdPath
|
||||
|
||||
if path == "" {
|
||||
var err error
|
||||
@ -196,7 +196,7 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) {
|
||||
defer errorhandling.CloseQuiet(syncW)
|
||||
|
||||
havePortMapping := len(ctr.Config().PortMappings) > 0
|
||||
logPath := filepath.Join(ctr.runtime.config.TmpDir, fmt.Sprintf("slirp4netns-%s.log", ctr.config.ID))
|
||||
logPath := filepath.Join(ctr.runtime.config.Engine.TmpDir, fmt.Sprintf("slirp4netns-%s.log", ctr.config.ID))
|
||||
|
||||
cmdArgs := []string{}
|
||||
slirpFeatures, err := checkSlirpFlags(path)
|
||||
@ -338,7 +338,7 @@ func (r *Runtime) setupRootlessPortMapping(ctr *Container, netnsPath string) (er
|
||||
defer errorhandling.CloseQuiet(syncR)
|
||||
defer errorhandling.CloseQuiet(syncW)
|
||||
|
||||
logPath := filepath.Join(ctr.runtime.config.TmpDir, fmt.Sprintf("rootlessport-%s.log", ctr.config.ID))
|
||||
logPath := filepath.Join(ctr.runtime.config.Engine.TmpDir, fmt.Sprintf("rootlessport-%s.log", ctr.config.ID))
|
||||
logFile, err := os.Create(logPath)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to open rootlessport log file %s", logPath)
|
||||
@ -362,7 +362,7 @@ func (r *Runtime) setupRootlessPortMapping(ctr *Container, netnsPath string) (er
|
||||
NetNSPath: netnsPath,
|
||||
ExitFD: 3,
|
||||
ReadyFD: 4,
|
||||
TmpDir: ctr.runtime.config.TmpDir,
|
||||
TmpDir: ctr.runtime.config.Engine.TmpDir,
|
||||
}
|
||||
cfgJSON, err := json.Marshal(cfg)
|
||||
if err != nil {
|
||||
@ -485,7 +485,7 @@ func (r *Runtime) teardownNetNS(ctr *Container) error {
|
||||
logrus.Debugf("Tearing down network namespace at %s for container %s", ctr.state.NetNS.Path(), ctr.ID())
|
||||
|
||||
// rootless containers do not use the CNI plugin
|
||||
if !rootless.IsRootless() && ctr.config.NetMode != "slirp4netns" {
|
||||
if !rootless.IsRootless() && !ctr.config.NetMode.IsSlirp4netns() {
|
||||
var requestedIP net.IP
|
||||
if ctr.requestedIP != nil {
|
||||
requestedIP = ctr.requestedIP
|
||||
|
Reference in New Issue
Block a user