mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-09-04 04:41:34 +00:00
Replacing isReservedNetwork with Driver capability
Currently store makes use of a static isReservedNetwork check to decide if a network needs to be stored in the distributed store or not. But it is better if the check is not static, but be determined based on the capability of the driver that backs the network. Hence introducing a new capability mechanism to the driver which it can express its capability during registration. Making use of first such capability : Scope. This can be expanded in the future for more such cases. Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
@@ -110,7 +110,10 @@ func Init(dc driverapi.DriverCallback) error {
|
||||
if out, err := exec.Command("modprobe", "-va", "bridge", "nf_nat", "br_netfilter").Output(); err != nil {
|
||||
logrus.Warnf("Running modprobe bridge nf_nat failed with message: %s, error: %v", out, err)
|
||||
}
|
||||
return dc.RegisterDriver(networkType, newDriver())
|
||||
c := driverapi.Capability{
|
||||
Scope: driverapi.LocalScope,
|
||||
}
|
||||
return dc.RegisterDriver(networkType, newDriver(), c)
|
||||
}
|
||||
|
||||
// Validate performs a static validation on the network configuration parameters.
|
||||
|
||||
@@ -16,7 +16,10 @@ type driver struct {
|
||||
|
||||
// Init registers a new instance of host driver
|
||||
func Init(dc driverapi.DriverCallback) error {
|
||||
return dc.RegisterDriver(networkType, &driver{})
|
||||
c := driverapi.Capability{
|
||||
Scope: driverapi.LocalScope,
|
||||
}
|
||||
return dc.RegisterDriver(networkType, &driver{}, c)
|
||||
}
|
||||
|
||||
func (d *driver) Config(option map[string]interface{}) error {
|
||||
|
||||
@@ -16,7 +16,10 @@ type driver struct {
|
||||
|
||||
// Init registers a new instance of null driver
|
||||
func Init(dc driverapi.DriverCallback) error {
|
||||
return dc.RegisterDriver(networkType, &driver{})
|
||||
c := driverapi.Capability{
|
||||
Scope: driverapi.LocalScope,
|
||||
}
|
||||
return dc.RegisterDriver(networkType, &driver{}, c)
|
||||
}
|
||||
|
||||
func (d *driver) Config(option map[string]interface{}) error {
|
||||
|
||||
@@ -23,7 +23,10 @@ func newDriver(name string, client *plugins.Client) driverapi.Driver {
|
||||
// plugin is activated.
|
||||
func Init(dc driverapi.DriverCallback) error {
|
||||
plugins.Handle(driverapi.NetworkPluginEndpointType, func(name string, client *plugins.Client) {
|
||||
if err := dc.RegisterDriver(name, newDriver(name, client)); err != nil {
|
||||
c := driverapi.Capability{
|
||||
Scope: driverapi.GlobalScope,
|
||||
}
|
||||
if err := dc.RegisterDriver(name, newDriver(name, client), c); err != nil {
|
||||
log.Errorf("error registering driver for %s due to %v", name, err)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -13,7 +13,10 @@ type driver struct{}
|
||||
|
||||
// Init registers a new instance of null driver
|
||||
func Init(dc driverapi.DriverCallback) error {
|
||||
return dc.RegisterDriver(networkType, &driver{})
|
||||
c := driverapi.Capability{
|
||||
Scope: driverapi.LocalScope,
|
||||
}
|
||||
return dc.RegisterDriver(networkType, &driver{}, c)
|
||||
}
|
||||
|
||||
func (d *driver) Config(option map[string]interface{}) error {
|
||||
|
||||
Reference in New Issue
Block a user