Added support for persisting Windows network driver specific options …
| ... | ... |
@@ -350,6 +350,9 @@ func (daemon *Daemon) initNetworkController(config *config.Config, activeSandbox |
| 350 | 350 |
} |
| 351 | 351 |
|
| 352 | 352 |
controller.WalkNetworks(s) |
| 353 |
+ |
|
| 354 |
+ drvOptions := make(map[string]string) |
|
| 355 |
+ |
|
| 353 | 356 |
if n != nil {
|
| 354 | 357 |
// global networks should not be deleted by local HNS |
| 355 | 358 |
if n.Info().Scope() == datastore.GlobalScope {
|
| ... | ... |
@@ -358,14 +361,23 @@ func (daemon *Daemon) initNetworkController(config *config.Config, activeSandbox |
| 358 | 358 |
v.Name = n.Name() |
| 359 | 359 |
// This will not cause network delete from HNS as the network |
| 360 | 360 |
// is not yet populated in the libnetwork windows driver |
| 361 |
+ |
|
| 362 |
+ // restore option if it existed before |
|
| 363 |
+ drvOptions = n.Info().DriverOptions() |
|
| 361 | 364 |
n.Delete() |
| 362 | 365 |
} |
| 363 |
- |
|
| 364 | 366 |
netOption := map[string]string{
|
| 365 | 367 |
winlibnetwork.NetworkName: v.Name, |
| 366 | 368 |
winlibnetwork.HNSID: v.Id, |
| 367 | 369 |
} |
| 368 | 370 |
|
| 371 |
+ // add persisted driver options |
|
| 372 |
+ for k, v := range drvOptions {
|
|
| 373 |
+ if k != winlibnetwork.NetworkName && k != winlibnetwork.HNSID {
|
|
| 374 |
+ netOption[k] = v |
|
| 375 |
+ } |
|
| 376 |
+ } |
|
| 377 |
+ |
|
| 369 | 378 |
v4Conf := []*libnetwork.IpamConf{}
|
| 370 | 379 |
for _, subnet := range v.Subnets {
|
| 371 | 380 |
ipamV4Conf := libnetwork.IpamConf{}
|