Merge pull request #9908 from crosbymichael/warning-graphdriver
Add warning log when high priority graphdriver used before
This commit is contained in:
commit
e404113afc
1 changed files with 19 additions and 1 deletions
|
@ -5,7 +5,9 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
)
|
||||
|
||||
|
@ -125,18 +127,34 @@ func New(root string, options []string) (driver Driver, err error) {
|
|||
}
|
||||
return nil, err
|
||||
}
|
||||
checkPriorDriver(name, root)
|
||||
return driver, nil
|
||||
}
|
||||
|
||||
// Check all registered drivers if no priority driver is found
|
||||
for _, initFunc := range drivers {
|
||||
for name, initFunc := range drivers {
|
||||
if driver, err = initFunc(root, options); err != nil {
|
||||
if err == ErrNotSupported || err == ErrPrerequisites || err == ErrIncompatibleFS {
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
checkPriorDriver(name, root)
|
||||
return driver, nil
|
||||
}
|
||||
return nil, fmt.Errorf("No supported storage backend found")
|
||||
}
|
||||
|
||||
func checkPriorDriver(name, root string) {
|
||||
priorDrivers := []string{}
|
||||
for prior := range drivers {
|
||||
if prior != name {
|
||||
if _, err := os.Stat(path.Join(root, prior)); err == nil {
|
||||
priorDrivers = append(priorDrivers, prior)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(priorDrivers) > 0 {
|
||||
log.Warnf("graphdriver %s selected. Warning: your graphdriver directory %s already contains data managed by other graphdrivers: %s", name, root, strings.Join(priorDrivers, ","))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue