mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows: Plumb through -b on daemon
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
4ef67b79bc
commit
e0ec0cc115
6 changed files with 22 additions and 17 deletions
|
@ -15,6 +15,7 @@ const (
|
|||
// common across platforms.
|
||||
type CommonConfig struct {
|
||||
AutoRestart bool
|
||||
Bridge bridgeConfig // Bridge holds bridge network specific configuration.
|
||||
Context map[string][]string
|
||||
CorsHeaders string
|
||||
DisableBridge bool
|
||||
|
|
|
@ -22,8 +22,6 @@ type Config struct {
|
|||
|
||||
// Fields below here are platform specific.
|
||||
|
||||
// Bridge holds bridge network specific configuration.
|
||||
Bridge bridgeConfig
|
||||
EnableSelinuxSupport bool
|
||||
SocketGroup string
|
||||
Ulimits map[string]*ulimit.Ulimit
|
||||
|
|
|
@ -2,6 +2,8 @@ package daemon
|
|||
|
||||
import (
|
||||
"os"
|
||||
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -10,6 +12,12 @@ var (
|
|||
defaultExec = "windows"
|
||||
)
|
||||
|
||||
// bridgeConfig stores all the bridge driver specific
|
||||
// configuration.
|
||||
type bridgeConfig struct {
|
||||
VirtualSwitchName string
|
||||
}
|
||||
|
||||
// Config defines the configuration of a docker daemon.
|
||||
// These are the configuration settings that you pass
|
||||
// to the docker daemon when you launch it with say: `docker -d -e windows`
|
||||
|
@ -28,6 +36,6 @@ func (config *Config) InstallFlags() {
|
|||
// First handle install flags which are consistent cross-platform
|
||||
config.InstallCommonFlags()
|
||||
|
||||
// Then platform-specific install flags. There are none presently on Windows
|
||||
|
||||
// Then platform-specific install flags.
|
||||
flag.StringVar(&config.Bridge.VirtualSwitchName, []string{"b", "-bridge"}, "", "Attach containers to a virtual switch")
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ func populateCommand(c *Container, env []string) error {
|
|||
network := c.NetworkSettings
|
||||
en.Interface = &execdriver.NetworkInterface{
|
||||
MacAddress: network.MacAddress,
|
||||
Bridge: c.daemon.config.Bridge.VirtualSwitchName,
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
@ -156,12 +157,6 @@ func (container *Container) GetSize() (int64, int64) {
|
|||
}
|
||||
|
||||
func (container *Container) AllocateNetwork() error {
|
||||
|
||||
// TODO Windows. This needs reworking with libnetwork. In the
|
||||
// proof-of-concept for //build conference, the Windows daemon
|
||||
// invoked eng.Job("allocate_interface) passing through
|
||||
// RequestedMac.
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -174,11 +169,9 @@ func (container *Container) ExportRw() (archive.Archive, error) {
|
|||
}
|
||||
|
||||
func (container *Container) ReleaseNetwork() {
|
||||
// TODO Windows. Rework with libnetwork
|
||||
}
|
||||
|
||||
func (container *Container) RestoreNetwork() error {
|
||||
// TODO Windows. Rework with libnetwork
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ import (
|
|||
"github.com/microsoft/hcsshim"
|
||||
)
|
||||
|
||||
const DefaultVirtualSwitch = "Virtual Switch"
|
||||
|
||||
func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error) {
|
||||
return daemon.driver.Changes(container.ID, container.ImageID)
|
||||
}
|
||||
|
@ -125,7 +127,10 @@ func isBridgeNetworkDisabled(config *Config) bool {
|
|||
}
|
||||
|
||||
func initNetworkController(config *Config) (libnetwork.NetworkController, error) {
|
||||
// TODO Windows
|
||||
// Set the name of the virtual switch if not specified by -b on daemon start
|
||||
if config.Bridge.VirtualSwitchName == "" {
|
||||
config.Bridge.VirtualSwitchName = DefaultVirtualSwitch
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,6 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
|||
}
|
||||
|
||||
if c.Network.Interface != nil {
|
||||
|
||||
// TODO Windows: Temporary
|
||||
c.Network.Interface.Bridge = "Virtual Switch"
|
||||
|
||||
dev := device{
|
||||
DeviceType: "Network",
|
||||
Connection: &networkConnection{
|
||||
|
@ -101,7 +97,11 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
|||
}
|
||||
}
|
||||
|
||||
logrus.Debugf("Virtual switch '%s', mac='%s'", c.Network.Interface.Bridge, c.Network.Interface.MacAddress)
|
||||
|
||||
cu.Devices = append(cu.Devices, dev)
|
||||
} else {
|
||||
logrus.Debugln("No network interface")
|
||||
}
|
||||
|
||||
configurationb, err := json.Marshal(cu)
|
||||
|
|
Loading…
Reference in a new issue