From 81c586e0e50639e7cc697b0c92433a85216be9b9 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 26 Jan 2016 15:09:29 +0000 Subject: [PATCH] Stop referring to requested IP address as "preferred", since it is an error if that address is unavailable. Signed-off-by: Bryan Boreham --- libnetwork/docs/ipam.md | 4 ++-- libnetwork/endpoint.go | 2 +- libnetwork/ipam/allocator.go | 2 +- libnetwork/ipam/allocator_test.go | 2 +- libnetwork/ipamapi/contract.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libnetwork/docs/ipam.md b/libnetwork/docs/ipam.md index b5f8874e71..5b4ee6e32a 100644 --- a/libnetwork/docs/ipam.md +++ b/libnetwork/docs/ipam.md @@ -41,7 +41,7 @@ type Ipam interface { RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) // ReleasePool releases the address pool identified by the passed id ReleasePool(poolID string) error - // Request address from the specified pool ID. Input options or preferred IP can be passed. + // Request address from the specified pool ID. Input options or required IP can be passed. RequestAddress(string, net.IP, map[string]string) (*net.IPNet, map[string]string, error) // Release the address from the specified pool ID ReleaseAddress(string, net.IP) error @@ -215,7 +215,7 @@ For this API, the remote driver will receive a POST message to the URL `/IpamDri Where: * `PoolID` is the pool identifier -* `Address` is the preferred address in regular IP form (A.B.C.D). If empty, the IPAM driver chooses any available address on the pool +* `Address` is the required address in regular IP form (A.B.C.D). If this address cannot be satisfied, the request fails. If empty, the IPAM driver chooses any available address on the pool * `Options` are IPAM driver specific options diff --git a/libnetwork/endpoint.go b/libnetwork/endpoint.go index 7577892377..08ea9ae815 100644 --- a/libnetwork/endpoint.go +++ b/libnetwork/endpoint.go @@ -911,7 +911,7 @@ func (ep *endpoint) assignAddressVersion(ipVer int, ipam ipamapi.Ipam) error { } } if progAdd != nil { - return types.BadRequestErrorf("Invalid preferred address %s: It does not belong to any of this network's subnets", prefAdd) + return types.BadRequestErrorf("Invalid address %s: It does not belong to any of this network's subnets", prefAdd) } return fmt.Errorf("no available IPv%d addresses on this network's address pools: %s (%s)", ipVer, n.Name(), n.ID()) } diff --git a/libnetwork/ipam/allocator.go b/libnetwork/ipam/allocator.go index 4fa7e1e972..bbaa7d11d2 100644 --- a/libnetwork/ipam/allocator.go +++ b/libnetwork/ipam/allocator.go @@ -489,7 +489,7 @@ func (a *Allocator) getAddress(nw *net.IPNet, bitmask *bitseq.Handle, prefAddres } else if prefAddress != nil { hostPart, e := types.GetHostPartIP(prefAddress, base.Mask) if e != nil { - return nil, types.InternalErrorf("failed to allocate preferred address %s: %v", prefAddress.String(), e) + return nil, types.InternalErrorf("failed to allocate requested address %s: %v", prefAddress.String(), e) } ordinal = ipToUint64(types.GetMinimalIP(hostPart)) err = bitmask.Set(ordinal) diff --git a/libnetwork/ipam/allocator_test.go b/libnetwork/ipam/allocator_test.go index 96dc2a9ab0..8e962c7f60 100644 --- a/libnetwork/ipam/allocator_test.go +++ b/libnetwork/ipam/allocator_test.go @@ -773,7 +773,7 @@ func TestRequestSyntaxCheck(t *testing.T) { ip := net.ParseIP("172.17.0.23") _, _, err = a.RequestAddress(pid, ip, nil) if err == nil { - t.Fatalf("Failed to detect wrong request: preferred IP from different subnet") + t.Fatalf("Failed to detect wrong request: requested IP from different subnet") } ip = net.ParseIP("192.168.0.50") diff --git a/libnetwork/ipamapi/contract.go b/libnetwork/ipamapi/contract.go index 5d561d81df..812bdbc068 100644 --- a/libnetwork/ipamapi/contract.go +++ b/libnetwork/ipamapi/contract.go @@ -67,7 +67,7 @@ type Ipam interface { RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) // ReleasePool releases the address pool identified by the passed id ReleasePool(poolID string) error - // Request address from the specified pool ID. Input options or preferred IP can be passed. + // Request address from the specified pool ID. Input options or required IP can be passed. RequestAddress(string, net.IP, map[string]string) (*net.IPNet, map[string]string, error) // Release the address from the specified pool ID ReleaseAddress(string, net.IP) error