Merge pull request #224 from mrjana/docker1.7.0_integ

Loopback interface not  brought up
This commit is contained in:
Madhu Venugopal
2015-05-27 13:44:37 -07:00
2 changed files with 10 additions and 8 deletions
+8 -6
View File
@@ -24,7 +24,7 @@ var (
garbagePathMap = make(map[string]bool)
gpmLock sync.Mutex
gpmWg sync.WaitGroup
gpmCleanupPeriod = 60
gpmCleanupPeriod = 60 * time.Second
)
// The networkNamespace type is the linux implementation of the Sandbox
@@ -56,7 +56,7 @@ func createBasePath() {
func removeUnusedPaths() {
for {
time.Sleep(time.Duration(gpmCleanupPeriod) * time.Second)
time.Sleep(time.Duration(gpmCleanupPeriod))
gpmLock.Lock()
pathList := make([]string, 0, len(garbagePathMap))
@@ -77,16 +77,14 @@ func removeUnusedPaths() {
func addToGarbagePaths(path string) {
gpmLock.Lock()
defer gpmLock.Unlock()
garbagePathMap[path] = true
defer gpmLock.Unlock()
}
func removeFromGarbagePaths(path string) {
gpmLock.Lock()
defer gpmLock.Unlock()
delete(garbagePathMap, path)
defer gpmLock.Unlock()
}
// GenerateKey generates a sandbox key based on the passed
@@ -119,6 +117,10 @@ func reexecCreateNamespace() {
if err := syscall.Mount("/proc/self/ns/net", os.Args[1], "bind", syscall.MS_BIND, ""); err != nil {
log.Fatal(err)
}
if err := loopbackUp(); err != nil {
log.Fatal(err)
}
}
func createNetworkNamespace(path string, osCreate bool) (*Info, error) {
+2 -2
View File
@@ -33,7 +33,7 @@ func newKey(t *testing.T) (string, error) {
}
// Set the rpmCleanupPeriod to be low to make the test run quicker
gpmCleanupPeriod = 2
gpmCleanupPeriod = 2 * time.Second
return name, nil
}
@@ -143,7 +143,7 @@ func verifySandbox(t *testing.T, s Sandbox) {
}
func verifyCleanup(t *testing.T, s Sandbox) {
time.Sleep(time.Duration(gpmCleanupPeriod*2) * time.Second)
time.Sleep(time.Duration(gpmCleanupPeriod * 2))
if _, err := os.Stat(s.Key()); err == nil {
t.Fatalf("The sandbox path %s is not getting cleanup event after twice the cleanup period", s.Key())
}