change code in container restore
Signed-off-by: allencloud <allen.sun@daocloud.io> Upstream-commit: 6184ff312dce3222d71ec7c2769002e2dd7595ed Component: engine
This commit is contained in:
@@ -51,7 +51,6 @@ import (
|
||||
"github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
volumedrivers "github.com/docker/docker/volume/drivers"
|
||||
"github.com/docker/docker/volume/local"
|
||||
"github.com/docker/docker/volume/store"
|
||||
@@ -106,27 +105,20 @@ type Daemon struct {
|
||||
|
||||
func (daemon *Daemon) restore() error {
|
||||
var (
|
||||
debug = utils.IsDebugEnabled()
|
||||
currentDriver = daemon.GraphDriverName()
|
||||
containers = make(map[string]*container.Container)
|
||||
)
|
||||
|
||||
if !debug {
|
||||
logrus.Info("Loading containers: start.")
|
||||
}
|
||||
logrus.Info("Loading containers: start.")
|
||||
|
||||
dir, err := ioutil.ReadDir(daemon.repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
containerCount := 0
|
||||
for _, v := range dir {
|
||||
id := v.Name()
|
||||
container, err := daemon.load(id)
|
||||
if !debug && logrus.GetLevel() == logrus.InfoLevel {
|
||||
fmt.Print(".")
|
||||
containerCount++
|
||||
}
|
||||
if err != nil {
|
||||
logrus.Errorf("Failed to load container %v: %v", id, err)
|
||||
continue
|
||||
@@ -348,12 +340,7 @@ func (daemon *Daemon) restore() error {
|
||||
|
||||
group.Wait()
|
||||
|
||||
if !debug {
|
||||
if logrus.GetLevel() == logrus.InfoLevel && containerCount > 0 {
|
||||
fmt.Println()
|
||||
}
|
||||
logrus.Info("Loading containers: done.")
|
||||
}
|
||||
logrus.Info("Loading containers: done.")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user