Add warnning log when other graphdrvier(storage driver) used before
added warnning log when other graphdrvier(storage driver) used before for feature request #8270 Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
This commit is contained in:
parent
d7f72188ff
commit
3c03827e73
1 changed files with 22 additions and 1 deletions
|
@ -5,7 +5,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -125,18 +127,37 @@ func New(root string, options []string) (driver Driver, err error) {
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
checkPriorDriver(name, root)
|
||||||
return driver, nil
|
return driver, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check all registered drivers if no priority driver is found
|
// 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 driver, err = initFunc(root, options); err != nil {
|
||||||
if err == ErrNotSupported || err == ErrPrerequisites || err == ErrIncompatibleFS {
|
if err == ErrNotSupported || err == ErrPrerequisites || err == ErrIncompatibleFS {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
checkPriorDriver(name, root)
|
||||||
return driver, nil
|
return driver, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("No supported storage backend found")
|
return nil, fmt.Errorf("No supported storage backend found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkPriorDriver(name string, root string) error {
|
||||||
|
|
||||||
|
var priorDrivers []string
|
||||||
|
|
||||||
|
for prior := range drivers {
|
||||||
|
if _, err := os.Stat(path.Join(root, prior)); err == nil && prior != name {
|
||||||
|
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, ","))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue