1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #3267 from vieux/debug_daemon_start

add some debug to runtime.restore()
This commit is contained in:
Guillaume J. Charmes 2013-12-18 13:45:22 -08:00
commit 210fa0871c
2 changed files with 14 additions and 7 deletions

View file

@ -56,6 +56,7 @@ func (graph *Graph) restore() error {
graph.idIndex.Add(id) graph.idIndex.Add(id)
} }
} }
utils.Debugf("Restored %d elements", len(dir))
return nil return nil
} }

View file

@ -189,7 +189,6 @@ func (runtime *Runtime) Register(container *Container) error {
} }
container.waitLock = make(chan struct{}) container.waitLock = make(chan struct{})
go container.monitor() go container.monitor()
} }
} }
@ -263,7 +262,6 @@ func (runtime *Runtime) Destroy(container *Container) error {
} }
func (runtime *Runtime) restore() error { func (runtime *Runtime) restore() error {
wheel := "-\\|/"
if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" { if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
fmt.Printf("Loading containers: ") fmt.Printf("Loading containers: ")
} }
@ -274,11 +272,11 @@ func (runtime *Runtime) restore() error {
containers := make(map[string]*Container) containers := make(map[string]*Container)
currentDriver := runtime.driver.String() currentDriver := runtime.driver.String()
for i, v := range dir { for _, v := range dir {
id := v.Name() id := v.Name()
container, err := runtime.load(id) container, err := runtime.load(id)
if i%21 == 0 && os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" { if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
fmt.Printf("\b%c", wheel[i%4]) fmt.Print(".")
} }
if err != nil { if err != nil {
utils.Errorf("Failed to load container %v: %v", id, err) 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 { if entities := runtime.containerGraph.List("/", -1); entities != nil {
for _, p := range entities.Paths() { for _, p := range entities.Paths() {
if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
fmt.Print(".")
}
e := entities[p] e := entities[p]
if container, ok := containers[e.ID()]; ok { if container, ok := containers[e.ID()]; ok {
register(container) register(container)
@ -325,7 +326,7 @@ func (runtime *Runtime) restore() error {
} }
if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" { if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" {
fmt.Printf("\bdone.\n") fmt.Printf(": done.\n")
} }
return nil return nil
@ -676,14 +677,17 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
} }
if ad, ok := driver.(*aufs.Driver); ok { if ad, ok := driver.(*aufs.Driver); ok {
utils.Debugf("Migrating existing containers")
if err := ad.Migrate(config.Root, setupInitLayer); err != nil { if err := ad.Migrate(config.Root, setupInitLayer); err != nil {
return nil, err return nil, err
} }
} }
utils.Debugf("Escaping AppArmor confinement")
if err := linkLxcStart(config.Root); err != nil { if err := linkLxcStart(config.Root); err != nil {
return nil, err return nil, err
} }
utils.Debugf("Creating images graph")
g, err := NewGraph(path.Join(config.Root, "graph"), driver) g, err := NewGraph(path.Join(config.Root, "graph"), driver)
if err != nil { if err != nil {
return nil, err return nil, err
@ -695,10 +699,12 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
utils.Debugf("Creating volumes graph")
volumes, err := NewGraph(path.Join(config.Root, "volumes"), volumesDriver) volumes, err := NewGraph(path.Join(config.Root, "volumes"), volumesDriver)
if err != nil { if err != nil {
return nil, err return nil, err
} }
utils.Debugf("Creating repository list")
repositories, err := NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g) repositories, err := NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g)
if err != nil { if err != nil {
return nil, fmt.Errorf("Couldn't create Tag store: %s", err) return nil, fmt.Errorf("Couldn't create Tag store: %s", err)