Преглед изворни кода

Merge pull request #1161 from aboch/fx

IPAM allocator to not accept a datastore update if already present
Madhu Venugopal пре 9 година
родитељ
комит
d29f63afe6
1 измењених фајлова са 5 додато и 3 уклоњено
  1. 5 3
      libnetwork/ipam/allocator.go

+ 5 - 3
libnetwork/ipam/allocator.go

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