Selaa lähdekoodia

Merge pull request #19738 from mrjana/mh

Vendoring libnetwork v0.6.0-rc5
Tibor Vass 9 vuotta sitten
vanhempi
commit
0e4eda1691

+ 1 - 1
hack/vendor.sh

@@ -27,7 +27,7 @@ clone git github.com/RackSec/srslog 6eb773f331e46fbba8eecb8e794e635e75fc04de
 clone git github.com/imdario/mergo 0.2.1
 clone git github.com/imdario/mergo 0.2.1
 
 
 #get libnetwork packages
 #get libnetwork packages
-clone git github.com/docker/libnetwork v0.6.0-rc4
+clone git github.com/docker/libnetwork v0.6.0-rc5
 clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
 clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
 clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
 clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
 clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4
 clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4

+ 5 - 2
vendor/src/github.com/docker/libnetwork/CHANGELOG.md

@@ -1,5 +1,8 @@
 # Changelog
 # Changelog
 
 
+## 0.6.0-rc5 (2016-01-26)
+- Cleanup stale overlay sandboxes
+
 ## 0.6.0-rc4 (2016-01-25)
 ## 0.6.0-rc4 (2016-01-25)
 - Add Endpoints() API to Sandbox interface
 - Add Endpoints() API to Sandbox interface
 - Fixed a race-condition in default gateway network creation
 - Fixed a race-condition in default gateway network creation
@@ -17,7 +20,7 @@
 
 
 ## 0.6.0-rc1 (2016-01-14)
 ## 0.6.0-rc1 (2016-01-14)
 - Fixes docker/docker#19404
 - Fixes docker/docker#19404
-- Fixes the ungraceful daemon restart issue in systemd with remote network plugin 
+- Fixes the ungraceful daemon restart issue in systemd with remote network plugin
   (https://github.com/docker/libnetwork/issues/813)
   (https://github.com/docker/libnetwork/issues/813)
 
 
 ## 0.5.6 (2016-01-14)
 ## 0.5.6 (2016-01-14)
@@ -70,6 +73,6 @@
 - Fixed a bunch of issues with osl namespace mgmt
 - Fixed a bunch of issues with osl namespace mgmt
 
 
 ## 0.3.0 (2015-05-27)
 ## 0.3.0 (2015-05-27)
- 
+
 - Introduce CNM (Container Networking Model)
 - Introduce CNM (Container Networking Model)
 - Replace docker networking with CNM & Bridge driver
 - Replace docker networking with CNM & Bridge driver

+ 26 - 0
vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_network.go

@@ -5,6 +5,8 @@ import (
 	"fmt"
 	"fmt"
 	"net"
 	"net"
 	"os"
 	"os"
+	"path/filepath"
+	"strings"
 	"sync"
 	"sync"
 	"syscall"
 	"syscall"
 
 
@@ -298,6 +300,26 @@ func (n *network) initSubnetSandbox(s *subnet) error {
 	return nil
 	return nil
 }
 }
 
 
+func (n *network) cleanupStaleSandboxes() {
+	filepath.Walk(filepath.Dir(osl.GenerateKey("walk")),
+		func(path string, info os.FileInfo, err error) error {
+			_, fname := filepath.Split(path)
+
+			pList := strings.Split(fname, "-")
+			if len(pList) <= 1 {
+				return nil
+			}
+
+			pattern := pList[1]
+			if strings.Contains(n.id, pattern) {
+				syscall.Unmount(path, syscall.MNT_DETACH)
+				os.Remove(path)
+			}
+
+			return nil
+		})
+}
+
 func (n *network) initSandbox() error {
 func (n *network) initSandbox() error {
 	n.Lock()
 	n.Lock()
 	n.initEpoch++
 	n.initEpoch++
@@ -311,6 +333,10 @@ func (n *network) initSandbox() error {
 		}
 		}
 	}
 	}
 
 
+	// If there are any stale sandboxes related to this network
+	// from previous daemon life clean it up here
+	n.cleanupStaleSandboxes()
+
 	sbox, err := osl.NewSandbox(
 	sbox, err := osl.NewSandbox(
 		osl.GenerateKey(fmt.Sprintf("%d-", n.initEpoch)+n.id), !hostMode)
 		osl.GenerateKey(fmt.Sprintf("%d-", n.initEpoch)+n.id), !hostMode)
 	if err != nil {
 	if err != nil {