mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-08 06:51:40 +00:00
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:
@@ -57,7 +57,7 @@ type Driver struct {
|
||||
|
||||
// New returns a new AUFS driver.
|
||||
// An error is returned if AUFS is not supported.
|
||||
func Init(root string) (graphdriver.Driver, error) {
|
||||
func Init(root string, options []string) (graphdriver.Driver, error) {
|
||||
// Try to load the aufs kernel module
|
||||
if err := supportsAufs(); err != nil {
|
||||
return nil, graphdriver.ErrNotSupported
|
||||
|
||||
@@ -17,7 +17,7 @@ var (
|
||||
)
|
||||
|
||||
func testInit(dir string, t *testing.T) graphdriver.Driver {
|
||||
d, err := Init(dir)
|
||||
d, err := Init(dir, nil)
|
||||
if err != nil {
|
||||
if err == graphdriver.ErrNotSupported {
|
||||
t.Skip(err)
|
||||
|
||||
@@ -22,7 +22,7 @@ func init() {
|
||||
graphdriver.Register("btrfs", Init)
|
||||
}
|
||||
|
||||
func Init(home string) (graphdriver.Driver, error) {
|
||||
func Init(home string, options []string) (graphdriver.Driver, error) {
|
||||
rootdir := path.Dir(home)
|
||||
|
||||
var buf syscall.Statfs_t
|
||||
|
||||
@@ -26,7 +26,7 @@ type Driver struct {
|
||||
home string
|
||||
}
|
||||
|
||||
func Init(home string) (graphdriver.Driver, error) {
|
||||
func Init(home string, options []string) (graphdriver.Driver, error) {
|
||||
deviceSet, err := NewDeviceSet(home, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func newDriver(t *testing.T, name string) *Driver {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
d, err := graphdriver.GetDriver(name, root)
|
||||
d, err := graphdriver.GetDriver(name, root, nil)
|
||||
if err != nil {
|
||||
if err == graphdriver.ErrNotSupported || err == graphdriver.ErrPrerequisites {
|
||||
t.Skip("Driver %s not supported", name)
|
||||
|
||||
@@ -12,7 +12,7 @@ func init() {
|
||||
graphdriver.Register("vfs", Init)
|
||||
}
|
||||
|
||||
func Init(home string) (graphdriver.Driver, error) {
|
||||
func Init(home string, options []string) (graphdriver.Driver, error) {
|
||||
d := &Driver{
|
||||
home: home,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user