Ensure `podman inspect` output for NetworkMode is right
I realized that setting NetworkMode to private when we are making a network namespace but not configuring it with CNI or Slirp is wrong; that's considered `--net=none` not `--net=private`. At the same time, realized that we actually store whether Slirp is in use, so we can be more specific than just "default" and instead say slirp4netns or bridge. Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
parent
c57c560d90
commit
8238b7e706
|
|
@ -580,7 +580,10 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
|
||||||
networkMode := ""
|
networkMode := ""
|
||||||
switch {
|
switch {
|
||||||
case c.config.CreateNetNS:
|
case c.config.CreateNetNS:
|
||||||
networkMode = "default"
|
// We actually store the network
|
||||||
|
// mode for Slirp and Bridge, so
|
||||||
|
// we can just use that
|
||||||
|
networkMode = string(c.config.NetMode)
|
||||||
case c.config.NetNsCtr != "":
|
case c.config.NetNsCtr != "":
|
||||||
networkMode = fmt.Sprintf("container:%s", c.config.NetNsCtr)
|
networkMode = fmt.Sprintf("container:%s", c.config.NetNsCtr)
|
||||||
default:
|
default:
|
||||||
|
|
@ -594,7 +597,10 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
|
||||||
if ns.Path != "" {
|
if ns.Path != "" {
|
||||||
networkMode = fmt.Sprintf("ns:%s", ns.Path)
|
networkMode = fmt.Sprintf("ns:%s", ns.Path)
|
||||||
} else {
|
} else {
|
||||||
networkMode = "private"
|
// We're making a network ns, but not
|
||||||
|
// configuring with Slirp or CNI. That
|
||||||
|
// means it's --net=none
|
||||||
|
networkMode = "none"
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue