Browse code

Initialize libnetwork and IPAMDriver with pluginstore.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>

Anusha Ragunathan authored on 2016/09/27 02:08:52
Showing 4 changed files
... ...
@@ -47,6 +47,7 @@ import (
47 47
 	"github.com/docker/docker/pkg/sysinfo"
48 48
 	"github.com/docker/docker/pkg/system"
49 49
 	"github.com/docker/docker/pkg/truncindex"
50
+	plugingetter "github.com/docker/docker/plugin/getter"
50 51
 	pluginstore "github.com/docker/docker/plugin/store"
51 52
 	"github.com/docker/docker/reference"
52 53
 	"github.com/docker/docker/registry"
... ...
@@ -1095,7 +1096,7 @@ func (daemon *Daemon) reloadClusterDiscovery(config *Config) error {
1095 1095
 	if daemon.netController == nil {
1096 1096
 		return nil
1097 1097
 	}
1098
-	netOptions, err := daemon.networkOptions(daemon.configStore, nil)
1098
+	netOptions, err := daemon.networkOptions(daemon.configStore, daemon.pluginStore, nil)
1099 1099
 	if err != nil {
1100 1100
 		logrus.WithError(err).Warnf("failed to get options with network controller")
1101 1101
 		return nil
... ...
@@ -1112,7 +1113,7 @@ func isBridgeNetworkDisabled(config *Config) bool {
1112 1112
 	return config.bridgeConfig.Iface == disableNetworkBridge
1113 1113
 }
1114 1114
 
1115
-func (daemon *Daemon) networkOptions(dconfig *Config, activeSandboxes map[string]interface{}) ([]nwconfig.Option, error) {
1115
+func (daemon *Daemon) networkOptions(dconfig *Config, pg plugingetter.PluginGetter, activeSandboxes map[string]interface{}) ([]nwconfig.Option, error) {
1116 1116
 	options := []nwconfig.Option{}
1117 1117
 	if dconfig == nil {
1118 1118
 		return options, nil
... ...
@@ -1153,6 +1154,10 @@ func (daemon *Daemon) networkOptions(dconfig *Config, activeSandboxes map[string
1153 1153
 		options = append(options, nwconfig.OptionActiveSandboxes(activeSandboxes))
1154 1154
 	}
1155 1155
 
1156
+	if pg != nil {
1157
+		options = append(options, nwconfig.OptionPluginGetter(pg))
1158
+	}
1159
+
1156 1160
 	return options, nil
1157 1161
 }
1158 1162
 
... ...
@@ -609,7 +609,7 @@ func configureKernelSecuritySupport(config *Config, driverName string) error {
609 609
 }
610 610
 
611 611
 func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[string]interface{}) (libnetwork.NetworkController, error) {
612
-	netOptions, err := daemon.networkOptions(config, activeSandboxes)
612
+	netOptions, err := daemon.networkOptions(config, daemon.pluginStore, activeSandboxes)
613 613
 	if err != nil {
614 614
 		return nil, err
615 615
 	}
... ...
@@ -188,7 +188,7 @@ func TestNetworkOptions(t *testing.T) {
188 188
 		},
189 189
 	}
190 190
 
191
-	if _, err := daemon.networkOptions(dconfigCorrect, nil); err != nil {
191
+	if _, err := daemon.networkOptions(dconfigCorrect, nil, nil); err != nil {
192 192
 		t.Fatalf("Expect networkOptions success, got error: %v", err)
193 193
 	}
194 194
 
... ...
@@ -198,7 +198,7 @@ func TestNetworkOptions(t *testing.T) {
198 198
 		},
199 199
 	}
200 200
 
201
-	if _, err := daemon.networkOptions(dconfigWrong, nil); err == nil {
201
+	if _, err := daemon.networkOptions(dconfigWrong, nil, nil); err == nil {
202 202
 		t.Fatalf("Expected networkOptions error, got nil")
203 203
 	}
204 204
 }
... ...
@@ -186,7 +186,7 @@ func configureMaxThreads(config *Config) error {
186 186
 }
187 187
 
188 188
 func (daemon *Daemon) initNetworkController(config *Config, activeSandboxes map[string]interface{}) (libnetwork.NetworkController, error) {
189
-	netOptions, err := daemon.networkOptions(config, nil)
189
+	netOptions, err := daemon.networkOptions(config, nil, nil)
190 190
 	if err != nil {
191 191
 		return nil, err
192 192
 	}