From 51c93c0f3318efa95a02d25677a1a4837f1af9f6 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 7 Nov 2013 19:02:15 -0800 Subject: [PATCH] Fix aufs error at startup Add String methods to other drivers --- aufs/aufs.go | 2 +- devmapper/driver.go | 4 ++++ graphdriver/driver.go | 3 ++- graphdriver/dummy/driver.go | 10 ++++++---- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/aufs/aufs.go b/aufs/aufs.go index 761ac075af..f4cb52dd9b 100644 --- a/aufs/aufs.go +++ b/aufs/aufs.go @@ -58,7 +58,7 @@ func Init(root string) (graphdriver.Driver, error) { // if it already exists // If not populate the dir structure aufsPath := path.Join(root, "aufs") - if err := os.Mkdir(aufsPath, 0755); err != nil { + if err := os.MkdirAll(aufsPath, 0755); err != nil { if os.IsExist(err) { return &AufsDriver{root}, nil } diff --git a/devmapper/driver.go b/devmapper/driver.go index 909f3cf974..c4bc5dcff2 100644 --- a/devmapper/driver.go +++ b/devmapper/driver.go @@ -33,6 +33,10 @@ func Init(home string) (graphdriver.Driver, error) { return d, nil } +func (d *Driver) String() string { + return "devicemapper" +} + func (d *Driver) Cleanup() error { return d.DeviceSet.Shutdown() } diff --git a/graphdriver/driver.go b/graphdriver/driver.go index bebbf02d3d..3a44f86a09 100644 --- a/graphdriver/driver.go +++ b/graphdriver/driver.go @@ -3,10 +3,10 @@ package graphdriver import ( "fmt" "github.com/dotcloud/docker/archive" + "github.com/dotcloud/docker/utils" "os" ) - type InitFunc func(root string) (Driver, error) type Driver interface { @@ -64,6 +64,7 @@ func New(root string) (Driver, error) { for _, name := range priority { driver, lastError = getDriver(name, root) if lastError != nil { + utils.Debugf("Error loading driver %s: %s", name, lastError) continue } return driver, nil diff --git a/graphdriver/dummy/driver.go b/graphdriver/dummy/driver.go index 21db4f9859..986c89ae24 100644 --- a/graphdriver/dummy/driver.go +++ b/graphdriver/dummy/driver.go @@ -1,11 +1,11 @@ package dummy import ( + "fmt" "github.com/dotcloud/docker/archive" "github.com/dotcloud/docker/graphdriver" "os" "path" - "fmt" ) func init() { @@ -14,7 +14,7 @@ func init() { func Init(home string) (graphdriver.Driver, error) { d := &Driver{ - home: home, + home: home, } return d, nil } @@ -23,6 +23,10 @@ type Driver struct { home string } +func (d *Driver) String() string { + return "dummy" +} + func (d *Driver) Cleanup() error { return nil } @@ -52,7 +56,6 @@ func (d *Driver) dir(id string) string { return path.Join(d.home, "dir", path.Base(id)) } - func (d *Driver) Remove(id string) error { if _, err := os.Stat(d.dir(id)); err != nil { return err @@ -81,4 +84,3 @@ func (d *Driver) DiffSize(id string) (int64, error) { func (d *Driver) Changes(id string) ([]archive.Change, error) { return nil, fmt.Errorf("Not implemented") } -