1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Allow graphdriver plugins to use v2

Currently the plugin initialization is too late for a loaded v2 plugin
to be usable as a graph driver.

This moves the initialization up before we create the graph driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 020b051dfb)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Brian Goff 2016-11-18 16:54:11 -05:00 committed by Victor Vieux
parent e773e0e654
commit d63582c131
2 changed files with 7 additions and 7 deletions

View file

@ -550,7 +550,12 @@ func NewDaemon(config *Config, registryService registry.Service, containerdRemot
driverName = config.GraphDriver driverName = config.GraphDriver
} }
d.RegistryService = registryService
d.PluginStore = pluginstore.NewStore(config.Root) d.PluginStore = pluginstore.NewStore(config.Root)
// Plugin system initialization should happen before restore. Do not change order.
if err := d.pluginInit(config, containerdRemote); err != nil {
return nil, err
}
d.layerStore, err = layer.NewStoreFromOptions(layer.StoreOptions{ d.layerStore, err = layer.NewStoreFromOptions(layer.StoreOptions{
StorePath: config.Root, StorePath: config.Root,
@ -649,7 +654,6 @@ func NewDaemon(config *Config, registryService registry.Service, containerdRemot
Type: config.LogConfig.Type, Type: config.LogConfig.Type,
Config: config.LogConfig.Config, Config: config.LogConfig.Config,
} }
d.RegistryService = registryService
d.EventsService = eventsService d.EventsService = eventsService
d.volumes = volStore d.volumes = volStore
d.root = config.Root d.root = config.Root
@ -668,11 +672,6 @@ func NewDaemon(config *Config, registryService registry.Service, containerdRemot
return nil, err return nil, err
} }
// Plugin system initialization should happen before restore. Do not change order.
if err := d.pluginInit(config, containerdRemote); err != nil {
return nil, err
}
if err := d.restore(); err != nil { if err := d.restore(); err != nil {
return nil, err return nil, err
} }

View file

@ -3,6 +3,7 @@ package graphdriver
import ( import (
"fmt" "fmt"
"io" "io"
"path/filepath"
"github.com/docker/docker/pkg/plugingetter" "github.com/docker/docker/pkg/plugingetter"
) )
@ -26,5 +27,5 @@ func lookupPlugin(name, home string, opts []string, pg plugingetter.PluginGetter
func newPluginDriver(name, home string, opts []string, c pluginClient) (Driver, error) { func newPluginDriver(name, home string, opts []string, c pluginClient) (Driver, error) {
proxy := &graphDriverProxy{name, c} proxy := &graphDriverProxy{name, c}
return proxy, proxy.Init(home, opts) return proxy, proxy.Init(filepath.Join(home, name), opts)
} }