Push driver config during Init

Currently the driver configuration is pushed through a separate
api. This makes driver configuration possible at any arbitrary
time. This unncessarily complicates the driver implementation.
More importantly the driver does not get access to it's
configuration before it can do the handshake with libnetwork.
This make the internal drivers a little bit different to
external plugins which can get their configuration before the handshake
with libnetwork.

This PR attempts to fix that mismatch between internal drivers and
external plugins.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
Jana Radhakrishnan
2015-09-19 08:43:34 -07:00
parent 00a92f066e
commit 900aca112b
25 changed files with 208 additions and 347 deletions
+1 -5
View File
@@ -15,17 +15,13 @@ type driver struct {
}
// Init registers a new instance of null driver
func Init(dc driverapi.DriverCallback) error {
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
c := driverapi.Capability{
Scope: driverapi.LocalScope,
}
return dc.RegisterDriver(networkType, &driver{}, c)
}
func (d *driver) Config(option map[string]interface{}) error {
return nil
}
func (d *driver) CreateNetwork(id string, option map[string]interface{}) error {
d.Lock()
defer d.Unlock()