1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Invert network disable flag and logic (unbreaks TestAllocate*PortLocalhost)

This commit is contained in:
Stefan Praszalowicz 2013-07-22 19:00:35 -07:00
parent 964e826a9b
commit bc172e5e5f
2 changed files with 46 additions and 46 deletions

View file

@ -77,7 +77,7 @@ type Config struct {
Volumes map[string]struct{}
VolumesFrom string
Entrypoint []string
NetworkEnabled bool
NetworkDisabled bool
}
type HostConfig struct {
@ -180,7 +180,7 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
PortSpecs: flPorts,
User: *flUser,
Tty: *flTty,
NetworkEnabled: *flNetwork,
NetworkDisabled: !*flNetwork,
OpenStdin: *flStdin,
Memory: *flMemory,
CpuShares: *flCpuShares,
@ -515,7 +515,7 @@ func (container *Container) Start(hostConfig *HostConfig) error {
return err
}
if container.runtime.networkManager.disabled {
container.Config.NetworkEnabled = false
container.Config.NetworkDisabled = true
} else {
if err := container.allocateNetwork(); err != nil {
return err
@ -633,7 +633,7 @@ func (container *Container) Start(hostConfig *HostConfig) error {
}
// Networking
if container.Config.NetworkEnabled {
if !container.Config.NetworkDisabled {
params = append(params, "-g", container.network.Gateway.String())
}
@ -736,7 +736,7 @@ func (container *Container) StderrPipe() (io.ReadCloser, error) {
}
func (container *Container) allocateNetwork() error {
if !container.Config.NetworkEnabled {
if container.Config.NetworkDisabled {
return nil
}
@ -766,7 +766,7 @@ func (container *Container) allocateNetwork() error {
}
func (container *Container) releaseNetwork() {
if !container.Config.NetworkEnabled {
if container.Config.NetworkDisabled {
return
}
container.network.Release()

View file

@ -13,7 +13,10 @@ lxc.utsname = {{.Id}}
{{end}}
#lxc.aa_profile = unconfined
{{if .Config.NetworkEnabled}}
{{if .Config.NetworkDisabled}}
# network is disabled (-n=false)
lxc.network.type = empty
{{else}}
# network configuration
lxc.network.type = veth
lxc.network.flags = up
@ -21,9 +24,6 @@ lxc.network.link = {{.NetworkSettings.Bridge}}
lxc.network.name = eth0
lxc.network.mtu = 1500
lxc.network.ipv4 = {{.NetworkSettings.IPAddress}}/{{.NetworkSettings.IPPrefixLen}}
{{else}}
# Network configuration disabled
lxc.network.type = empty
{{end}}
# root filesystem