Merge pull request #3267 from vieux/debug_daemon_start
add some debug to runtime.restore()
This commit is contained in:
commit
210fa0871c
1
graph.go
1
graph.go
|
@ -56,6 +56,7 @@ func (graph *Graph) restore() error {
|
|||
graph.idIndex.Add(id)
|
||||
}
|
||||
}
|
||||
utils.Debugf("Restored %d elements", len(dir))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
18
runtime.go
18
runtime.go
|
@ -189,7 +189,6 @@ func (runtime *Runtime) Register(container *Container) error {
|
|||
}
|
||||
|
||||
container.waitLock = make(chan struct{})
|
||||
|
||||
go container.monitor()
|
||||
}
|
||||
}
|
||||
|
@ -263,7 +262,6 @@ func (runtime *Runtime) Destroy(container *Container) error {
|
|||
}
|
||||
|
||||
func (runtime *Runtime) restore() error {
|
||||
wheel := "-\\|/"
|
||||
if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
|
||||
fmt.Printf("Loading containers: ")
|
||||
}
|
||||
|
@ -274,11 +272,11 @@ func (runtime *Runtime) restore() error {
|
|||
containers := make(map[string]*Container)
|
||||
currentDriver := runtime.driver.String()
|
||||
|
||||
for i, v := range dir {
|
||||
for _, v := range dir {
|
||||
id := v.Name()
|
||||
container, err := runtime.load(id)
|
||||
if i%21 == 0 && os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
|
||||
fmt.Printf("\b%c", wheel[i%4])
|
||||
if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
|
||||
fmt.Print(".")
|
||||
}
|
||||
if err != nil {
|
||||
utils.Errorf("Failed to load container %v: %v", id, err)
|
||||
|
@ -302,6 +300,9 @@ func (runtime *Runtime) restore() error {
|
|||
|
||||
if entities := runtime.containerGraph.List("/", -1); entities != nil {
|
||||
for _, p := range entities.Paths() {
|
||||
if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
|
||||
fmt.Print(".")
|
||||
}
|
||||
e := entities[p]
|
||||
if container, ok := containers[e.ID()]; ok {
|
||||
register(container)
|
||||
|
@ -325,7 +326,7 @@ func (runtime *Runtime) restore() error {
|
|||
}
|
||||
|
||||
if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
|
||||
fmt.Printf("\bdone.\n")
|
||||
fmt.Printf(": done.\n")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -676,14 +677,17 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
|||
}
|
||||
|
||||
if ad, ok := driver.(*aufs.Driver); ok {
|
||||
utils.Debugf("Migrating existing containers")
|
||||
if err := ad.Migrate(config.Root, setupInitLayer); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
utils.Debugf("Escaping AppArmor confinement")
|
||||
if err := linkLxcStart(config.Root); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
utils.Debugf("Creating images graph")
|
||||
g, err := NewGraph(path.Join(config.Root, "graph"), driver)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -695,10 +699,12 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
utils.Debugf("Creating volumes graph")
|
||||
volumes, err := NewGraph(path.Join(config.Root, "volumes"), volumesDriver)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
utils.Debugf("Creating repository list")
|
||||
repositories, err := NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Couldn't create Tag store: %s", err)
|
||||
|
|
Loading…
Reference in New Issue