libnet/drivers: stop passing config to drivers...
...which ignore the config argument. Notably, none of the network drivers referenced by Swarmkit use config, which is good as Swarmkit unconditionally passes nil for the config when registering drivers. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
parent
1980deffae
commit
d519bde5da
10 changed files with 21 additions and 17 deletions
|
@ -15,11 +15,11 @@ type driver struct{}
|
|||
//
|
||||
// Deprecated: use [Register].
|
||||
func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error {
|
||||
return Register(dc, nil)
|
||||
return Register(dc)
|
||||
}
|
||||
|
||||
// Register registers a new instance of the bridge manager driver with r.
|
||||
func Register(r driverapi.Registerer, _ map[string]interface{}) error {
|
||||
func Register(r driverapi.Registerer) error {
|
||||
return r.RegisterDriver(networkType, &driver{}, driverapi.Capability{
|
||||
DataScope: datastore.LocalScope,
|
||||
ConnectivityScope: datastore.LocalScope,
|
||||
|
|
|
@ -20,10 +20,10 @@ type driver struct {
|
|||
//
|
||||
// Deprecated: use [Register].
|
||||
func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error {
|
||||
return Register(dc, nil)
|
||||
return Register(dc)
|
||||
}
|
||||
|
||||
func Register(r driverapi.Registerer, _ map[string]interface{}) error {
|
||||
func Register(r driverapi.Registerer) error {
|
||||
return r.RegisterDriver(NetworkType, &driver{}, driverapi.Capability{
|
||||
DataScope: datastore.LocalScope,
|
||||
ConnectivityScope: datastore.LocalScope,
|
||||
|
|
|
@ -15,11 +15,11 @@ type driver struct{}
|
|||
//
|
||||
// Deprecated: use [Register].
|
||||
func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error {
|
||||
return Register(dc, nil)
|
||||
return Register(dc)
|
||||
}
|
||||
|
||||
// Register registers a new instance of the ipvlan manager driver.
|
||||
func Register(r driverapi.Registerer, _ map[string]interface{}) error {
|
||||
func Register(r driverapi.Registerer) error {
|
||||
return r.RegisterDriver(networkType, &driver{}, driverapi.Capability{
|
||||
DataScope: datastore.LocalScope,
|
||||
ConnectivityScope: datastore.GlobalScope,
|
||||
|
|
|
@ -15,11 +15,11 @@ type driver struct{}
|
|||
//
|
||||
// Deprecated: use [Register].
|
||||
func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error {
|
||||
return Register(dc, nil)
|
||||
return Register(dc)
|
||||
}
|
||||
|
||||
// Register registers a new instance of the macvlan manager driver.
|
||||
func Register(r driverapi.Registerer, _ map[string]interface{}) error {
|
||||
func Register(r driverapi.Registerer) error {
|
||||
return r.RegisterDriver(networkType, &driver{}, driverapi.Capability{
|
||||
DataScope: datastore.LocalScope,
|
||||
ConnectivityScope: datastore.GlobalScope,
|
||||
|
|
|
@ -17,7 +17,7 @@ type driver struct {
|
|||
}
|
||||
|
||||
// Register registers a new instance of the null driver.
|
||||
func Register(r driverapi.Registerer, _ map[string]interface{}) error {
|
||||
func Register(r driverapi.Registerer) error {
|
||||
return r.RegisterDriver(NetworkType, &driver{}, driverapi.Capability{
|
||||
DataScope: datastore.LocalScope,
|
||||
})
|
||||
|
|
|
@ -50,11 +50,11 @@ type network struct {
|
|||
//
|
||||
// Deprecated: use [Register].
|
||||
func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error {
|
||||
return Register(dc, nil)
|
||||
return Register(dc)
|
||||
}
|
||||
|
||||
// Register registers a new instance of the overlay driver.
|
||||
func Register(r driverapi.Registerer, _ map[string]interface{}) error {
|
||||
func Register(r driverapi.Registerer) error {
|
||||
return r.RegisterDriver(networkType, newDriver(), driverapi.Capability{
|
||||
DataScope: datastore.GlobalScope,
|
||||
ConnectivityScope: datastore.GlobalScope,
|
||||
|
|
|
@ -26,7 +26,7 @@ type driver struct {
|
|||
}
|
||||
|
||||
// Register registers a new instance of the overlay driver.
|
||||
func Register(r driverapi.Registerer, _ map[string]interface{}) error {
|
||||
func Register(r driverapi.Registerer) error {
|
||||
d := &driver{
|
||||
networks: networkTable{},
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ import (
|
|||
)
|
||||
|
||||
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error {
|
||||
return null.Register(r, driverConfig(null.NetworkType))
|
||||
return null.Register(r)
|
||||
}
|
||||
|
|
|
@ -13,15 +13,19 @@ import (
|
|||
)
|
||||
|
||||
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error {
|
||||
noConfig := func(fn func(driverapi.Registerer) error) func(driverapi.Registerer, map[string]interface{}) error {
|
||||
return func(r driverapi.Registerer, _ map[string]interface{}) error { return fn(r) }
|
||||
}
|
||||
|
||||
for _, nr := range []struct {
|
||||
ntype string
|
||||
register func(driverapi.Registerer, map[string]interface{}) error
|
||||
}{
|
||||
{ntype: bridge.NetworkType, register: bridge.Register},
|
||||
{ntype: host.NetworkType, register: host.Register},
|
||||
{ntype: host.NetworkType, register: noConfig(host.Register)},
|
||||
{ntype: ipvlan.NetworkType, register: ipvlan.Register},
|
||||
{ntype: macvlan.NetworkType, register: macvlan.Register},
|
||||
{ntype: null.NetworkType, register: null.Register},
|
||||
{ntype: null.NetworkType, register: noConfig(null.Register)},
|
||||
{ntype: overlay.NetworkType, register: overlay.Register},
|
||||
} {
|
||||
if err := nr.register(r, driverConfig(nr.ntype)); err != nil {
|
||||
|
|
|
@ -12,12 +12,12 @@ import (
|
|||
func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error {
|
||||
for _, nr := range []struct {
|
||||
ntype string
|
||||
register func(driverapi.Registerer, map[string]interface{}) error
|
||||
register func(driverapi.Registerer) error
|
||||
}{
|
||||
{ntype: null.NetworkType, register: null.Register},
|
||||
{ntype: overlay.NetworkType, register: overlay.Register},
|
||||
} {
|
||||
if err := nr.register(r, driverConfig(nr.ntype)); err != nil {
|
||||
if err := nr.register(r); err != nil {
|
||||
return fmt.Errorf("failed to register %q driver: %w", nr.ntype, err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue