Merge pull request #636 from mrjana/bugs
Check if address space valid in getStore
This commit is contained in:
commit
5a5b542a03
2 changed files with 7 additions and 3 deletions
|
@ -130,7 +130,7 @@ func (a *Allocator) RequestPool(addressSpace, pool, subPool string, options map[
|
|||
log.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
|
||||
k, nw, ipr, err := a.parsePoolRequest(addressSpace, pool, subPool, v6)
|
||||
if err != nil {
|
||||
return "", nil, nil, ipamapi.ErrInvalidPool
|
||||
return "", nil, nil, types.InternalErrorf("failed to parse pool request for address space %q pool %q subpool %q: %v", addressSpace, pool, subPool, err)
|
||||
}
|
||||
|
||||
retry:
|
||||
|
@ -199,7 +199,7 @@ func (a *Allocator) getAddrSpace(as string) (*addrSpace, error) {
|
|||
defer a.Unlock()
|
||||
aSpace, ok := a.addrSpaces[as]
|
||||
if !ok {
|
||||
return nil, types.BadRequestErrorf("cannot find locality of address space: %s", as)
|
||||
return nil, types.BadRequestErrorf("cannot find address space %s (most likey the backing datastore is not configured)", as)
|
||||
}
|
||||
return aSpace, nil
|
||||
}
|
||||
|
|
|
@ -74,7 +74,11 @@ func (a *Allocator) getStore(as string) datastore.DataStore {
|
|||
a.Lock()
|
||||
defer a.Unlock()
|
||||
|
||||
return a.addrSpaces[as].ds
|
||||
if aSpace, ok := a.addrSpaces[as]; ok {
|
||||
return aSpace.ds
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *Allocator) getAddressSpaceFromStore(as string) (*addrSpace, error) {
|
||||
|
|
Loading…
Add table
Reference in a new issue