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

IPAM allocator to not accept a datastore update if already present

- Restoring the above behavior which got recently broken

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch 2016-05-09 13:36:40 -07:00
parent 0de68331ab
commit a9c9765b33

View file

@ -147,9 +147,11 @@ func (a *Allocator) initializeAddressSpace(as string, ds datastore.DataStore) er
} }
a.Lock() a.Lock()
if _, ok := a.addrSpaces[as]; ok { if currAS, ok := a.addrSpaces[as]; ok {
if currAS.ds != nil {
a.Unlock() a.Unlock()
return types.ForbiddenErrorf("tried to add an axisting address space: %s", as) return types.ForbiddenErrorf("a datastore is already configured for the address space %s", as)
}
} }
a.addrSpaces[as] = &addrSpace{ a.addrSpaces[as] = &addrSpace{
subnets: map[SubnetKey]*PoolData{}, subnets: map[SubnetKey]*PoolData{},