зеркало из https://github.com/microsoft/docker.git
Fix aufs error at startup
Add String methods to other drivers
This commit is contained in:
Родитель
8c21d2acd3
Коммит
51c93c0f33
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче