Add --storage-opt graph driver option and pass through to driver

This lets you add storage specific options for the daemon.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This commit is contained in:
Alexander Larsson
2014-06-05 10:42:27 +02:00
parent 948e54ac45
commit 822ea97ffc
13 changed files with 26 additions and 17 deletions
+7 -7
View File
@@ -15,7 +15,7 @@ const (
FsMagicAufs = FsMagic(0x61756673)
)
type InitFunc func(root string) (Driver, error)
type InitFunc func(root string, options []string) (Driver, error)
type Driver interface {
String() string
@@ -69,23 +69,23 @@ func Register(name string, initFunc InitFunc) error {
return nil
}
func GetDriver(name, home string) (Driver, error) {
func GetDriver(name, home string, options []string) (Driver, error) {
if initFunc, exists := drivers[name]; exists {
return initFunc(path.Join(home, name))
return initFunc(path.Join(home, name), options)
}
return nil, ErrNotSupported
}
func New(root string) (driver Driver, err error) {
func New(root string, options []string) (driver Driver, err error) {
for _, name := range []string{os.Getenv("DOCKER_DRIVER"), DefaultDriver} {
if name != "" {
return GetDriver(name, root)
return GetDriver(name, root, options)
}
}
// Check for priority drivers first
for _, name := range priority {
driver, err = GetDriver(name, root)
driver, err = GetDriver(name, root, options)
if err != nil {
if err == ErrNotSupported || err == ErrPrerequisites || err == ErrIncompatibleFS {
continue
@@ -97,7 +97,7 @@ func New(root string) (driver Driver, err error) {
// Check all registered drivers if no priority driver is found
for _, initFunc := range drivers {
if driver, err = initFunc(root); err != nil {
if driver, err = initFunc(root, options); err != nil {
if err == ErrNotSupported || err == ErrPrerequisites || err == ErrIncompatibleFS {
continue
}