Browse code

Merge pull request #26973 from allencloud/change-code-in-container-restore

change code in container restore

Sebastiaan van Stijn authored on 2016/10/22 10:53:38
Showing 2 changed files
... ...
@@ -52,7 +52,6 @@ import (
52 52
 	"github.com/docker/docker/reference"
53 53
 	"github.com/docker/docker/registry"
54 54
 	"github.com/docker/docker/runconfig"
55
-	"github.com/docker/docker/utils"
56 55
 	volumedrivers "github.com/docker/docker/volume/drivers"
57 56
 	"github.com/docker/docker/volume/local"
58 57
 	"github.com/docker/docker/volume/store"
... ...
@@ -107,27 +106,20 @@ type Daemon struct {
107 107
 
108 108
 func (daemon *Daemon) restore() error {
109 109
 	var (
110
-		debug         = utils.IsDebugEnabled()
111 110
 		currentDriver = daemon.GraphDriverName()
112 111
 		containers    = make(map[string]*container.Container)
113 112
 	)
114 113
 
115
-	if !debug {
116
-		logrus.Info("Loading containers: start.")
117
-	}
114
+	logrus.Info("Loading containers: start.")
115
+
118 116
 	dir, err := ioutil.ReadDir(daemon.repository)
119 117
 	if err != nil {
120 118
 		return err
121 119
 	}
122 120
 
123
-	containerCount := 0
124 121
 	for _, v := range dir {
125 122
 		id := v.Name()
126 123
 		container, err := daemon.load(id)
127
-		if !debug && logrus.GetLevel() == logrus.InfoLevel {
128
-			fmt.Print(".")
129
-			containerCount++
130
-		}
131 124
 		if err != nil {
132 125
 			logrus.Errorf("Failed to load container %v: %v", id, err)
133 126
 			continue
... ...
@@ -352,12 +344,7 @@ func (daemon *Daemon) restore() error {
352 352
 
353 353
 	group.Wait()
354 354
 
355
-	if !debug {
356
-		if logrus.GetLevel() == logrus.InfoLevel && containerCount > 0 {
357
-			fmt.Println()
358
-		}
359
-		logrus.Info("Loading containers: done.")
360
-	}
355
+	logrus.Info("Loading containers: done.")
361 356
 
362 357
 	return nil
363 358
 }
... ...
@@ -1265,49 +1265,6 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *check.C) {
1265 1265
 	c.Assert(out, checker.Contains, expected)
1266 1266
 }
1267 1267
 
1268
-func (s *DockerDaemonSuite) TestDaemonDots(c *check.C) {
1269
-	if err := s.d.StartWithBusybox(); err != nil {
1270
-		c.Fatal(err)
1271
-	}
1272
-
1273
-	// Now create 4 containers
1274
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1275
-		c.Fatalf("Error creating container: %q", err)
1276
-	}
1277
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1278
-		c.Fatalf("Error creating container: %q", err)
1279
-	}
1280
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1281
-		c.Fatalf("Error creating container: %q", err)
1282
-	}
1283
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1284
-		c.Fatalf("Error creating container: %q", err)
1285
-	}
1286
-
1287
-	s.d.Stop()
1288
-
1289
-	s.d.Start("--log-level=debug")
1290
-	s.d.Stop()
1291
-	content, _ := ioutil.ReadFile(s.d.logFile.Name())
1292
-	if strings.Contains(string(content), "....") {
1293
-		c.Fatalf("Debug level should not have ....\n%s", string(content))
1294
-	}
1295
-
1296
-	s.d.Start("--log-level=error")
1297
-	s.d.Stop()
1298
-	content, _ = ioutil.ReadFile(s.d.logFile.Name())
1299
-	if strings.Contains(string(content), "....") {
1300
-		c.Fatalf("Error level should not have ....\n%s", string(content))
1301
-	}
1302
-
1303
-	s.d.Start("--log-level=info")
1304
-	s.d.Stop()
1305
-	content, _ = ioutil.ReadFile(s.d.logFile.Name())
1306
-	if !strings.Contains(string(content), "....") {
1307
-		c.Fatalf("Info level should have ....\n%s", string(content))
1308
-	}
1309
-}
1310
-
1311 1268
 func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *check.C) {
1312 1269
 	dir, err := ioutil.TempDir("", "socket-cleanup-test")
1313 1270
 	if err != nil {