Loopback interface not t brought up
Loopback interface was s not brought up when wemoved to clone method of creating namespace. e. Adding it. Also taking care of PR R comments. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
parent
3ec19ff62b
commit
f429a2528d
|
@ -25,7 +25,7 @@ var (
|
||||||
garbagePathMap = make(map[string]bool)
|
garbagePathMap = make(map[string]bool)
|
||||||
gpmLock sync.Mutex
|
gpmLock sync.Mutex
|
||||||
gpmWg sync.WaitGroup
|
gpmWg sync.WaitGroup
|
||||||
gpmCleanupPeriod = 60
|
gpmCleanupPeriod = 60 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// The networkNamespace type is the linux implementation of the Sandbox
|
// The networkNamespace type is the linux implementation of the Sandbox
|
||||||
|
@ -57,7 +57,7 @@ func createBasePath() {
|
||||||
|
|
||||||
func removeUnusedPaths() {
|
func removeUnusedPaths() {
|
||||||
for {
|
for {
|
||||||
time.Sleep(time.Duration(gpmCleanupPeriod) * time.Second)
|
time.Sleep(time.Duration(gpmCleanupPeriod))
|
||||||
|
|
||||||
gpmLock.Lock()
|
gpmLock.Lock()
|
||||||
pathList := make([]string, 0, len(garbagePathMap))
|
pathList := make([]string, 0, len(garbagePathMap))
|
||||||
|
@ -78,16 +78,14 @@ func removeUnusedPaths() {
|
||||||
|
|
||||||
func addToGarbagePaths(path string) {
|
func addToGarbagePaths(path string) {
|
||||||
gpmLock.Lock()
|
gpmLock.Lock()
|
||||||
defer gpmLock.Unlock()
|
|
||||||
|
|
||||||
garbagePathMap[path] = true
|
garbagePathMap[path] = true
|
||||||
|
defer gpmLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeFromGarbagePaths(path string) {
|
func removeFromGarbagePaths(path string) {
|
||||||
gpmLock.Lock()
|
gpmLock.Lock()
|
||||||
defer gpmLock.Unlock()
|
|
||||||
|
|
||||||
delete(garbagePathMap, path)
|
delete(garbagePathMap, path)
|
||||||
|
defer gpmLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateKey generates a sandbox key based on the passed
|
// GenerateKey generates a sandbox key based on the passed
|
||||||
|
@ -120,6 +118,10 @@ func reexecCreateNamespace() {
|
||||||
if err := syscall.Mount("/proc/self/ns/net", os.Args[1], "bind", syscall.MS_BIND, ""); err != nil {
|
if err := syscall.Mount("/proc/self/ns/net", os.Args[1], "bind", syscall.MS_BIND, ""); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := loopbackUp(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func createNetworkNamespace(path string, osCreate bool) (*Info, error) {
|
func createNetworkNamespace(path string, osCreate bool) (*Info, error) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ func newKey(t *testing.T) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the rpmCleanupPeriod to be low to make the test run quicker
|
// Set the rpmCleanupPeriod to be low to make the test run quicker
|
||||||
gpmCleanupPeriod = 2
|
gpmCleanupPeriod = 2 * time.Second
|
||||||
|
|
||||||
return name, nil
|
return name, nil
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ func verifySandbox(t *testing.T, s Sandbox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyCleanup(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 {
|
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())
|
t.Fatalf("The sandbox path %s is not getting cleanup event after twice the cleanup period", s.Key())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue