mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
improve aufs cleanup and debugging
This commit is contained in:
parent
f6629bbbd5
commit
43899a77bf
2 changed files with 23 additions and 6 deletions
|
@ -182,14 +182,17 @@ func (a *AufsDriver) Remove(id string) error {
|
|||
return err
|
||||
}
|
||||
realPath := path.Join(a.rootPath(), p, id)
|
||||
if err := os.Rename(realPath, tmp); err != nil {
|
||||
if err := os.Rename(realPath, tmp); err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(tmp)
|
||||
}
|
||||
|
||||
// Remove the layers file for the id
|
||||
return os.Remove(path.Join(a.rootPath(), "layers", id))
|
||||
if err := os.Remove(path.Join(a.rootPath(), "layers", id)); err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Return the rootfs path for the id
|
||||
|
@ -300,7 +303,7 @@ func (a *AufsDriver) Cleanup() error {
|
|||
}
|
||||
for _, id := range ids {
|
||||
if err := a.unmount(id); err != nil {
|
||||
return err
|
||||
utils.Errorf("Unmounting %s: %s", utils.TruncateID(id), err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
20
runtime.go
20
runtime.go
|
@ -725,9 +725,23 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
|||
}
|
||||
|
||||
func (runtime *Runtime) Close() error {
|
||||
runtime.networkManager.Close()
|
||||
runtime.driver.Cleanup()
|
||||
return runtime.containerGraph.Close()
|
||||
errorsStrings := []string{}
|
||||
if err := runtime.networkManager.Close(); err != nil {
|
||||
utils.Errorf("runtime.networkManager.Close(): %s", err.Error())
|
||||
errorsStrings = append(errorsStrings, err.Error())
|
||||
}
|
||||
if err := runtime.driver.Cleanup(); err != nil {
|
||||
utils.Errorf("runtime.driver.Cleanup(): %s", err.Error())
|
||||
errorsStrings = append(errorsStrings, err.Error())
|
||||
}
|
||||
if err := runtime.containerGraph.Close(); err != nil {
|
||||
utils.Errorf("runtime.containerGraph.Close(): %s", err.Error())
|
||||
errorsStrings = append(errorsStrings, err.Error())
|
||||
}
|
||||
if len(errorsStrings) > 0 {
|
||||
return fmt.Errorf("%s", strings.Join(errorsStrings, ", "))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (runtime *Runtime) Mount(container *Container) error {
|
||||
|
|
Loading…
Reference in a new issue