Make network a slice to support multiple types
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
87e010b2e9
commit
4f6cdc6f08
7 changed files with 44 additions and 47 deletions
|
@ -84,18 +84,15 @@ func (ns *linuxNs) SetupCgroups(container *libcontainer.Container, nspid int) er
|
|||
}
|
||||
|
||||
func (ns *linuxNs) InitializeNetworking(container *libcontainer.Container, nspid int, pipe *SyncPipe) error {
|
||||
if container.Network != nil {
|
||||
strategy, err := network.GetStrategy(container.Network.Type)
|
||||
context := libcontainer.Context{}
|
||||
for _, config := range container.Networks {
|
||||
strategy, err := network.GetStrategy(config.Type)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
networkContext, err := strategy.Create(container.Network, nspid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := pipe.SendToChild(networkContext); err != nil {
|
||||
if err := strategy.Create(config, nspid, context); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return pipe.SendToChild(context)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue