|
@@ -1,10 +1,8 @@
|
|
|
package builtin
|
|
|
|
|
|
import (
|
|
|
- "errors"
|
|
|
"net"
|
|
|
|
|
|
- "github.com/docker/docker/libnetwork/datastore"
|
|
|
"github.com/docker/docker/libnetwork/ipam"
|
|
|
"github.com/docker/docker/libnetwork/ipamapi"
|
|
|
"github.com/docker/docker/libnetwork/ipamutils"
|
|
@@ -15,25 +13,8 @@ var (
|
|
|
defaultAddressPool []*net.IPNet
|
|
|
)
|
|
|
|
|
|
-// initBuiltin registers the built-in ipam service with libnetwork
|
|
|
-func initBuiltin(ic ipamapi.Callback, l, g interface{}) error {
|
|
|
- var (
|
|
|
- ok bool
|
|
|
- localDs, globalDs datastore.DataStore
|
|
|
- )
|
|
|
-
|
|
|
- if l != nil {
|
|
|
- if localDs, ok = l.(datastore.DataStore); !ok {
|
|
|
- return errors.New("incorrect local datastore passed to built-in ipam init")
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if g != nil {
|
|
|
- if globalDs, ok = g.(datastore.DataStore); !ok {
|
|
|
- return errors.New("incorrect global datastore passed to built-in ipam init")
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+// registerBuiltin registers the built-in ipam driver with libnetwork.
|
|
|
+func registerBuiltin(ic ipamapi.Registerer) error {
|
|
|
var localAddressPool []*net.IPNet
|
|
|
if len(defaultAddressPool) > 0 {
|
|
|
localAddressPool = append([]*net.IPNet(nil), defaultAddressPool...)
|
|
@@ -41,7 +22,7 @@ func initBuiltin(ic ipamapi.Callback, l, g interface{}) error {
|
|
|
localAddressPool = ipamutils.GetLocalScopeDefaultNetworks()
|
|
|
}
|
|
|
|
|
|
- a, err := ipam.NewAllocator(localDs, globalDs, localAddressPool, ipamutils.GetGlobalScopeDefaultNetworks())
|
|
|
+ a, err := ipam.NewAllocator(nil, nil, localAddressPool, ipamutils.GetGlobalScopeDefaultNetworks())
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|