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

Merge pull request #1644 from sanimej/self

Update the local VTEP in peerdb on receiving self discovery
This commit is contained in:
Madhu Venugopal 2017-02-10 22:27:10 -08:00 committed by GitHub
commit 962d13481c
2 changed files with 16 additions and 0 deletions

View file

@ -48,6 +48,7 @@ type driver struct {
vxlanIdm *idm.Idm
once sync.Once
joinOnce sync.Once
localJoinOnce sync.Once
keys []*key
sync.Mutex
}
@ -241,6 +242,12 @@ func (d *driver) nodeJoin(advertiseAddress, bindAddress string, self bool) {
d.bindAddress = bindAddress
d.Unlock()
// If containers are already running on this network update the
// advertiseaddress in the peerDB
d.localJoinOnce.Do(func() {
d.peerDBUpdateSelf()
})
// If there is no cluster store there is no need to start serf.
if d.store != nil {
if err := validateSelf(advertiseAddress); err != nil {

View file

@ -367,3 +367,12 @@ func (d *driver) pushLocalDb() {
return false
})
}
func (d *driver) peerDBUpdateSelf() {
d.peerDbWalk(func(nid string, pkey *peerKey, pEntry *peerEntry) bool {
if pEntry.isLocal {
pEntry.vtep = net.ParseIP(d.advertiseAddress)
}
return false
})
}