Initialize libnetwork and IPAMDriver with pluginstore.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
Anusha Ragunathan 2016-09-26 10:08:52 -07:00
parent 2b0f0d0d71
commit a00940f02c
4 changed files with 11 additions and 6 deletions

View file

@ -47,6 +47,7 @@ import (
"github.com/docker/docker/pkg/sysinfo"
"github.com/docker/docker/pkg/system"
"github.com/docker/docker/pkg/truncindex"
plugingetter "github.com/docker/docker/plugin/getter"
pluginstore "github.com/docker/docker/plugin/store"
"github.com/docker/docker/reference"
"github.com/docker/docker/registry"
@ -1095,7 +1096,7 @@ func (daemon *Daemon) reloadClusterDiscovery(config *Config) error {
if daemon.netController == nil {
return nil
}
netOptions, err := daemon.networkOptions(daemon.configStore, nil)
netOptions, err := daemon.networkOptions(daemon.configStore, daemon.pluginStore, nil)
if err != nil {
logrus.WithError(err).Warnf("failed to get options with network controller")
return nil
@ -1112,7 +1113,7 @@ func isBridgeNetworkDisabled(config *Config) bool {
return config.bridgeConfig.Iface == disableNetworkBridge
}
func (daemon *Daemon) networkOptions(dconfig *Config, activeSandboxes map[string]interface{}) ([]nwconfig.Option, error) {
func (daemon *Daemon) networkOptions(dconfig *Config, pg plugingetter.PluginGetter, activeSandboxes map[string]interface{}) ([]nwconfig.Option, error) {
options := []nwconfig.Option{}
if dconfig == nil {
return options, nil
@ -1153,6 +1154,10 @@ func (daemon *Daemon) networkOptions(dconfig *Config, activeSandboxes map[string
options = append(options, nwconfig.OptionActiveSandboxes(activeSandboxes))
}
if pg != nil {
options = append(options, nwconfig.OptionPluginGetter(pg))
}
return options, nil
}

View file

@ -609,7 +609,7 @@ func configureKernelSecuritySupport(config *Config, driverName string) error {
}
func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[string]interface{}) (libnetwork.NetworkController, error) {
netOptions, err := daemon.networkOptions(config, activeSandboxes)
netOptions, err := daemon.networkOptions(config, daemon.pluginStore, activeSandboxes)
if err != nil {
return nil, err
}

View file

@ -188,7 +188,7 @@ func TestNetworkOptions(t *testing.T) {
},
}
if _, err := daemon.networkOptions(dconfigCorrect, nil); err != nil {
if _, err := daemon.networkOptions(dconfigCorrect, nil, nil); err != nil {
t.Fatalf("Expect networkOptions success, got error: %v", err)
}
@ -198,7 +198,7 @@ func TestNetworkOptions(t *testing.T) {
},
}
if _, err := daemon.networkOptions(dconfigWrong, nil); err == nil {
if _, err := daemon.networkOptions(dconfigWrong, nil, nil); err == nil {
t.Fatalf("Expected networkOptions error, got nil")
}
}

View file

@ -186,7 +186,7 @@ func configureMaxThreads(config *Config) error {
}
func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[string]interface{}) (libnetwork.NetworkController, error) {
netOptions, err := daemon.networkOptions(config, nil)
netOptions, err := daemon.networkOptions(config, nil, nil)
if err != nil {
return nil, err
}