Browse code

change code in container restore

Signed-off-by: allencloud <allen.sun@daocloud.io>

allencloud authored on 2016/09/28 15:41:19
Showing 2 changed files
... ...
@@ -51,7 +51,6 @@ import (
51 51
 	"github.com/docker/docker/reference"
52 52
 	"github.com/docker/docker/registry"
53 53
 	"github.com/docker/docker/runconfig"
54
-	"github.com/docker/docker/utils"
55 54
 	volumedrivers "github.com/docker/docker/volume/drivers"
56 55
 	"github.com/docker/docker/volume/local"
57 56
 	"github.com/docker/docker/volume/store"
... ...
@@ -106,27 +105,20 @@ type Daemon struct {
106 106
 
107 107
 func (daemon *Daemon) restore() error {
108 108
 	var (
109
-		debug         = utils.IsDebugEnabled()
110 109
 		currentDriver = daemon.GraphDriverName()
111 110
 		containers    = make(map[string]*container.Container)
112 111
 	)
113 112
 
114
-	if !debug {
115
-		logrus.Info("Loading containers: start.")
116
-	}
113
+	logrus.Info("Loading containers: start.")
114
+
117 115
 	dir, err := ioutil.ReadDir(daemon.repository)
118 116
 	if err != nil {
119 117
 		return err
120 118
 	}
121 119
 
122
-	containerCount := 0
123 120
 	for _, v := range dir {
124 121
 		id := v.Name()
125 122
 		container, err := daemon.load(id)
126
-		if !debug && logrus.GetLevel() == logrus.InfoLevel {
127
-			fmt.Print(".")
128
-			containerCount++
129
-		}
130 123
 		if err != nil {
131 124
 			logrus.Errorf("Failed to load container %v: %v", id, err)
132 125
 			continue
... ...
@@ -348,12 +340,7 @@ func (daemon *Daemon) restore() error {
348 348
 
349 349
 	group.Wait()
350 350
 
351
-	if !debug {
352
-		if logrus.GetLevel() == logrus.InfoLevel && containerCount > 0 {
353
-			fmt.Println()
354
-		}
355
-		logrus.Info("Loading containers: done.")
356
-	}
351
+	logrus.Info("Loading containers: done.")
357 352
 
358 353
 	return nil
359 354
 }
... ...
@@ -1247,49 +1247,6 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *check.C) {
1247 1247
 	c.Assert(out, checker.Contains, expected)
1248 1248
 }
1249 1249
 
1250
-func (s *DockerDaemonSuite) TestDaemonDots(c *check.C) {
1251
-	if err := s.d.StartWithBusybox(); err != nil {
1252
-		c.Fatal(err)
1253
-	}
1254
-
1255
-	// Now create 4 containers
1256
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1257
-		c.Fatalf("Error creating container: %q", err)
1258
-	}
1259
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1260
-		c.Fatalf("Error creating container: %q", err)
1261
-	}
1262
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1263
-		c.Fatalf("Error creating container: %q", err)
1264
-	}
1265
-	if _, err := s.d.Cmd("create", "busybox"); err != nil {
1266
-		c.Fatalf("Error creating container: %q", err)
1267
-	}
1268
-
1269
-	s.d.Stop()
1270
-
1271
-	s.d.Start("--log-level=debug")
1272
-	s.d.Stop()
1273
-	content, _ := ioutil.ReadFile(s.d.logFile.Name())
1274
-	if strings.Contains(string(content), "....") {
1275
-		c.Fatalf("Debug level should not have ....\n%s", string(content))
1276
-	}
1277
-
1278
-	s.d.Start("--log-level=error")
1279
-	s.d.Stop()
1280
-	content, _ = ioutil.ReadFile(s.d.logFile.Name())
1281
-	if strings.Contains(string(content), "....") {
1282
-		c.Fatalf("Error level should not have ....\n%s", string(content))
1283
-	}
1284
-
1285
-	s.d.Start("--log-level=info")
1286
-	s.d.Stop()
1287
-	content, _ = ioutil.ReadFile(s.d.logFile.Name())
1288
-	if !strings.Contains(string(content), "....") {
1289
-		c.Fatalf("Info level should have ....\n%s", string(content))
1290
-	}
1291
-}
1292
-
1293 1250
 func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *check.C) {
1294 1251
 	dir, err := ioutil.TempDir("", "socket-cleanup-test")
1295 1252
 	if err != nil {