Browse code

Update libnetwork to 96d45528599c32354230480a1ebc0

This fixes an issue with hanging tests due to store.

Fixes #23560

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
(cherry picked from commit e927df7b4b58099113b5086371b1d80ff517f564)

Michael Crosby authored on 2016/06/16 07:07:04
Showing 6 changed files
... ...
@@ -65,7 +65,7 @@ clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
65 65
 clone git github.com/imdario/mergo 0.2.1
66 66
 
67 67
 #get libnetwork packages
68
-clone git github.com/docker/libnetwork 0d517a9e4e5cbdb889b3257eebd2351addcd46d4
68
+clone git github.com/docker/libnetwork 96d45528599c32354230480a1ebc0657cd4d077f
69 69
 clone git github.com/docker/go-events 39718a26497694185f8fb58a7d6f31947f3dc42d
70 70
 clone git github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
71 71
 clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
... ...
@@ -203,6 +203,8 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
203 203
 		}
204 204
 	}
205 205
 
206
+	c.WalkNetworks(populateSpecial)
207
+
206 208
 	// Reserve pools first before doing cleanup. Otherwise the
207 209
 	// cleanups of endpoint/network and sandbox below will
208 210
 	// generate many unnecessary warnings
... ...
@@ -70,7 +70,7 @@ func (e *encrMap) String() string {
70 70
 }
71 71
 
72 72
 func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal, add bool) error {
73
-	log.Infof("checkEncryption(%s, %v, %d, %t)", nid[0:7], rIP, vxlanID, isLocal)
73
+	log.Debugf("checkEncryption(%s, %v, %d, %t)", nid[0:7], rIP, vxlanID, isLocal)
74 74
 
75 75
 	n := d.network(nid)
76 76
 	if n == nil || !n.secure {
... ...
@@ -120,7 +120,7 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal
120 120
 }
121 121
 
122 122
 func setupEncryption(localIP, remoteIP net.IP, vni uint32, em *encrMap, keys []*key) error {
123
-	log.Infof("Programming encryption for vxlan %d between %s and %s", vni, localIP, remoteIP)
123
+	log.Debugf("Programming encryption for vxlan %d between %s and %s", vni, localIP, remoteIP)
124 124
 	rIPs := remoteIP.String()
125 125
 
126 126
 	indices := make([]*spi, 0, len(keys))
... ...
@@ -242,7 +242,7 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f
242 242
 		}
243 243
 
244 244
 		if add != exists {
245
-			log.Infof("%s: rSA{%s}", action, rSA)
245
+			log.Debugf("%s: rSA{%s}", action, rSA)
246 246
 			if err := xfrmProgram(rSA); err != nil {
247 247
 				log.Warnf("Failed %s rSA{%s}: %v", action, rSA, err)
248 248
 			}
... ...
@@ -267,7 +267,7 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f
267 267
 		}
268 268
 
269 269
 		if add != exists {
270
-			log.Infof("%s fSA{%s}", action, fSA)
270
+			log.Debugf("%s fSA{%s}", action, fSA)
271 271
 			if err := xfrmProgram(fSA); err != nil {
272 272
 				log.Warnf("Failed %s fSA{%s}: %v.", action, fSA, err)
273 273
 			}
... ...
@@ -313,7 +313,7 @@ func programSP(fSA *netlink.XfrmState, rSA *netlink.XfrmState, add bool) error {
313 313
 	}
314 314
 
315 315
 	if add != exists {
316
-		log.Infof("%s fSP{%s}", action, fPol)
316
+		log.Debugf("%s fSP{%s}", action, fPol)
317 317
 		if err := xfrmProgram(fPol); err != nil {
318 318
 			log.Warnf("%s fSP{%s}: %v", action, fPol, err)
319 319
 		}
... ...
@@ -380,16 +380,16 @@ func (d *driver) setKeys(keys []*key) error {
380 380
 		return types.ForbiddenErrorf("initial keys are already present")
381 381
 	}
382 382
 	d.keys = keys
383
-	log.Infof("Initial encryption keys: %v", d.keys)
383
+	log.Debugf("Initial encryption keys: %v", d.keys)
384 384
 	return nil
385 385
 }
386 386
 
387 387
 // updateKeys allows to add a new key and/or change the primary key and/or prune an existing key
388 388
 // The primary key is the key used in transmission and will go in first position in the list.
389 389
 func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
390
-	log.Infof("Updating Keys. New: %v, Primary: %v, Pruned: %v", newKey, primary, pruneKey)
390
+	log.Debugf("Updating Keys. New: %v, Primary: %v, Pruned: %v", newKey, primary, pruneKey)
391 391
 
392
-	log.Infof("Current: %v", d.keys)
392
+	log.Debugf("Current: %v", d.keys)
393 393
 
394 394
 	var (
395 395
 		newIdx = -1
... ...
@@ -444,7 +444,7 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
444 444
 	}
445 445
 	d.Unlock()
446 446
 
447
-	log.Infof("Updated: %v", d.keys)
447
+	log.Debugf("Updated: %v", d.keys)
448 448
 
449 449
 	return nil
450 450
 }
... ...
@@ -458,10 +458,10 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
458 458
 
459 459
 // Spis and keys are sorted in such away the one in position 0 is the primary
460 460
 func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx, delIdx int) []*spi {
461
-	log.Infof("Updating keys for node: %s (%d,%d,%d)", rIP, newIdx, priIdx, delIdx)
461
+	log.Debugf("Updating keys for node: %s (%d,%d,%d)", rIP, newIdx, priIdx, delIdx)
462 462
 
463 463
 	spis := idxs
464
-	log.Infof("Current: %v", spis)
464
+	log.Debugf("Current: %v", spis)
465 465
 
466 466
 	// add new
467 467
 	if newIdx != -1 {
... ...
@@ -482,7 +482,7 @@ func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx,
482 482
 			Crypt:  &netlink.XfrmStateAlgo{Name: "cbc(aes)", Key: curKeys[delIdx].value},
483 483
 			Limits: netlink.XfrmStateLimits{TimeSoft: timeout},
484 484
 		}
485
-		log.Infof("Updating rSA0{%s}", rSA0)
485
+		log.Debugf("Updating rSA0{%s}", rSA0)
486 486
 		if err := ns.NlHandle().XfrmStateUpdate(rSA0); err != nil {
487 487
 			log.Warnf("Failed to update rSA0{%s}: %v", rSA0, err)
488 488
 		}
... ...
@@ -518,7 +518,7 @@ func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx,
518 518
 				},
519 519
 			},
520 520
 		}
521
-		log.Infof("Updating fSP{%s}", fSP1)
521
+		log.Debugf("Updating fSP{%s}", fSP1)
522 522
 		if err := ns.NlHandle().XfrmPolicyUpdate(fSP1); err != nil {
523 523
 			log.Warnf("Failed to update fSP{%s}: %v", fSP1, err)
524 524
 		}
... ...
@@ -533,7 +533,7 @@ func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx,
533 533
 			Crypt:  &netlink.XfrmStateAlgo{Name: "cbc(aes)", Key: curKeys[0].value},
534 534
 			Limits: netlink.XfrmStateLimits{TimeHard: timeout},
535 535
 		}
536
-		log.Infof("Removing fSA0{%s}", fSA0)
536
+		log.Debugf("Removing fSA0{%s}", fSA0)
537 537
 		if err := ns.NlHandle().XfrmStateUpdate(fSA0); err != nil {
538 538
 			log.Warnf("Failed to remove fSA0{%s}: %v", fSA0, err)
539 539
 		}
... ...
@@ -553,7 +553,7 @@ func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx,
553 553
 		spis = append(spis[:delIdx], spis[delIdx+1:]...)
554 554
 	}
555 555
 
556
-	log.Infof("Updated: %v", spis)
556
+	log.Debugf("Updated: %v", spis)
557 557
 
558 558
 	return spis
559 559
 }
... ...
@@ -987,7 +987,7 @@ func (ep *endpoint) assignAddress(ipam ipamapi.Ipam, assignIPv4, assignIPv6 bool
987 987
 	var err error
988 988
 
989 989
 	n := ep.getNetwork()
990
-	if n.Type() == "host" || n.Type() == "null" {
990
+	if n.hasSpecialDriver() {
991 991
 		return nil
992 992
 	}
993 993
 
... ...
@@ -1067,7 +1067,7 @@ func (ep *endpoint) assignAddressVersion(ipVer int, ipam ipamapi.Ipam) error {
1067 1067
 
1068 1068
 func (ep *endpoint) releaseAddress() {
1069 1069
 	n := ep.getNetwork()
1070
-	if n.Type() == "host" || n.Type() == "null" {
1070
+	if n.hasSpecialDriver() {
1071 1071
 		return
1072 1072
 	}
1073 1073
 
... ...
@@ -1123,8 +1123,7 @@ func (n *network) getController() *controller {
1123 1123
 }
1124 1124
 
1125 1125
 func (n *network) ipamAllocate() error {
1126
-	// For now also exclude bridge from using new ipam
1127
-	if n.Type() == "host" || n.Type() == "null" {
1126
+	if n.hasSpecialDriver() {
1128 1127
 		return nil
1129 1128
 	}
1130 1129
 
... ...
@@ -1295,8 +1294,7 @@ func (n *network) ipamAllocateVersion(ipVer int, ipam ipamapi.Ipam) error {
1295 1295
 }
1296 1296
 
1297 1297
 func (n *network) ipamRelease() {
1298
-	// For now exclude host and null
1299
-	if n.Type() == "host" || n.Type() == "null" {
1298
+	if n.hasSpecialDriver() {
1300 1299
 		return
1301 1300
 	}
1302 1301
 	ipam, _, err := n.getController().getIPAMDriver(n.ipamType)
... ...
@@ -1504,3 +1502,8 @@ func (n *network) TableEventRegister(tableName string) error {
1504 1504
 	n.driverTables = append(n.driverTables, tableName)
1505 1505
 	return nil
1506 1506
 }
1507
+
1508
+// Special drivers are ones which do not need to perform any network plumbing
1509
+func (n *network) hasSpecialDriver() bool {
1510
+	return n.Type() == "host" || n.Type() == "null"
1511
+}
... ...
@@ -464,3 +464,12 @@ func (c *controller) networkCleanup() {
464 464
 		}
465 465
 	}
466 466
 }
467
+
468
+var populateSpecial NetworkWalker = func(nw Network) bool {
469
+	if n := nw.(*network); n.hasSpecialDriver() {
470
+		if err := n.getController().addNetwork(n); err != nil {
471
+			log.Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
472
+		}
473
+	}
474
+	return false
475
+}