From 15ff9de65801178a522c445ff9fb8964e21d12a0 Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Fri, 17 Jun 2016 09:13:35 -0700 Subject: [PATCH] plugins: remove automatic mounting of a state dir Signed-off-by: Tibor Vass --- plugin/manager.go | 9 +-------- plugin/manager_linux.go | 11 +++++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/plugin/manager.go b/plugin/manager.go index a33248ba93..006905764f 100644 --- a/plugin/manager.go +++ b/plugin/manager.go @@ -22,10 +22,7 @@ import ( "github.com/docker/engine-api/types" ) -const ( - defaultPluginRuntimeDestination = "/run/docker/plugins" - defaultPluginStateDestination = "/state" -) +const defaultPluginRuntimeDestination = "/run/docker/plugins" var manager *Manager @@ -49,7 +46,6 @@ type plugin struct { P types.Plugin `json:"plugin"` client *plugins.Client restartManager restartmanager.RestartManager - stateSourcePath string runtimeSourcePath string } @@ -72,7 +68,6 @@ func (pm *Manager) newPlugin(ref reference.Named, id string) *plugin { Name: ref.Name(), ID: id, }, - stateSourcePath: filepath.Join(pm.libRoot, id, "state"), runtimeSourcePath: filepath.Join(pm.runRoot, id), } if ref, ok := ref.(reference.NamedTagged); ok { @@ -82,7 +77,6 @@ func (pm *Manager) newPlugin(ref reference.Named, id string) *plugin { } func (pm *Manager) restorePlugin(p *plugin) error { - p.stateSourcePath = filepath.Join(pm.libRoot, p.P.ID, "state") p.runtimeSourcePath = filepath.Join(pm.runRoot, p.P.ID) if p.P.Active { return pm.restore(p) @@ -342,7 +336,6 @@ func (pm *Manager) remove(p *plugin) error { } pm.Lock() // fixme: lock single record defer pm.Unlock() - os.RemoveAll(p.stateSourcePath) delete(pm.plugins, p.P.ID) delete(pm.nameToID, p.Name()) pm.save() diff --git a/plugin/manager_linux.go b/plugin/manager_linux.go index 75da3beefb..277fa3c48e 100644 --- a/plugin/manager_linux.go +++ b/plugin/manager_linux.go @@ -70,11 +70,6 @@ func (pm *Manager) initSpec(p *plugin) (*specs.Spec, error) { Destination: defaultPluginRuntimeDestination, Type: "bind", Options: []string{"rbind", "rshared"}, - }, types.PluginMount{ - Source: &p.stateSourcePath, - Destination: defaultPluginStateDestination, - Type: "bind", - Options: []string{"rbind", "rshared"}, }) for _, mount := range mounts { m := specs.Mount{ @@ -105,10 +100,14 @@ func (pm *Manager) initSpec(p *plugin) (*specs.Spec, error) { envs = append(envs, p.P.Config.Env...) args := append(p.P.Manifest.Entrypoint, p.P.Config.Args...) + cwd := p.P.Manifest.Workdir + if len(cwd) == 0 { + cwd = "/" + } s.Process = specs.Process{ Terminal: false, Args: args, - Cwd: "/", // TODO: add in manifest? + Cwd: cwd, Env: envs, }