mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1226 from mavenugo/ag
Overlay driver's NetworkAllocate method must honor driver options
This commit is contained in:
commit
dc9d01e670
1 changed files with 15 additions and 10 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/libnetwork/datastore"
|
"github.com/docker/libnetwork/datastore"
|
||||||
"github.com/docker/libnetwork/discoverapi"
|
"github.com/docker/libnetwork/discoverapi"
|
||||||
"github.com/docker/libnetwork/driverapi"
|
"github.com/docker/libnetwork/driverapi"
|
||||||
|
@ -80,9 +81,11 @@ func (d *driver) NetworkAllocate(id string, option map[string]string, ipV4Data,
|
||||||
subnets: []*subnet{},
|
subnets: []*subnet{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts := make(map[string]string)
|
||||||
vxlanIDList := make([]uint32, 0, len(ipV4Data))
|
vxlanIDList := make([]uint32, 0, len(ipV4Data))
|
||||||
if val, ok := option[netlabel.OverlayVxlanIDList]; ok {
|
for key, val := range option {
|
||||||
log.Println("overlay network option: ", val)
|
if key == netlabel.OverlayVxlanIDList {
|
||||||
|
logrus.Debugf("overlay network option: %s", val)
|
||||||
valStrList := strings.Split(val, ",")
|
valStrList := strings.Split(val, ",")
|
||||||
for _, idStr := range valStrList {
|
for _, idStr := range valStrList {
|
||||||
vni, err := strconv.Atoi(idStr)
|
vni, err := strconv.Atoi(idStr)
|
||||||
|
@ -92,6 +95,9 @@ func (d *driver) NetworkAllocate(id string, option map[string]string, ipV4Data,
|
||||||
|
|
||||||
vxlanIDList = append(vxlanIDList, uint32(vni))
|
vxlanIDList = append(vxlanIDList, uint32(vni))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
opts[key] = val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, ipd := range ipV4Data {
|
for i, ipd := range ipV4Data {
|
||||||
|
@ -111,7 +117,6 @@ func (d *driver) NetworkAllocate(id string, option map[string]string, ipV4Data,
|
||||||
n.subnets = append(n.subnets, s)
|
n.subnets = append(n.subnets, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := make(map[string]string)
|
|
||||||
val := fmt.Sprintf("%d", n.subnets[0].vni)
|
val := fmt.Sprintf("%d", n.subnets[0].vni)
|
||||||
for _, s := range n.subnets[1:] {
|
for _, s := range n.subnets[1:] {
|
||||||
val = val + fmt.Sprintf(",%d", s.vni)
|
val = val + fmt.Sprintf(",%d", s.vni)
|
||||||
|
|
Loading…
Add table
Reference in a new issue