plugins: remove automatic mounting of a state dir

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2016-06-17 09:13:35 -07:00
parent 4b70d4561e
commit 15ff9de658
2 changed files with 6 additions and 14 deletions

View file

@ -22,10 +22,7 @@ import (
"github.com/docker/engine-api/types" "github.com/docker/engine-api/types"
) )
const ( const defaultPluginRuntimeDestination = "/run/docker/plugins"
defaultPluginRuntimeDestination = "/run/docker/plugins"
defaultPluginStateDestination = "/state"
)
var manager *Manager var manager *Manager
@ -49,7 +46,6 @@ type plugin struct {
P types.Plugin `json:"plugin"` P types.Plugin `json:"plugin"`
client *plugins.Client client *plugins.Client
restartManager restartmanager.RestartManager restartManager restartmanager.RestartManager
stateSourcePath string
runtimeSourcePath string runtimeSourcePath string
} }
@ -72,7 +68,6 @@ func (pm *Manager) newPlugin(ref reference.Named, id string) *plugin {
Name: ref.Name(), Name: ref.Name(),
ID: id, ID: id,
}, },
stateSourcePath: filepath.Join(pm.libRoot, id, "state"),
runtimeSourcePath: filepath.Join(pm.runRoot, id), runtimeSourcePath: filepath.Join(pm.runRoot, id),
} }
if ref, ok := ref.(reference.NamedTagged); ok { 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 { 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) p.runtimeSourcePath = filepath.Join(pm.runRoot, p.P.ID)
if p.P.Active { if p.P.Active {
return pm.restore(p) return pm.restore(p)
@ -342,7 +336,6 @@ func (pm *Manager) remove(p *plugin) error {
} }
pm.Lock() // fixme: lock single record pm.Lock() // fixme: lock single record
defer pm.Unlock() defer pm.Unlock()
os.RemoveAll(p.stateSourcePath)
delete(pm.plugins, p.P.ID) delete(pm.plugins, p.P.ID)
delete(pm.nameToID, p.Name()) delete(pm.nameToID, p.Name())
pm.save() pm.save()

View file

@ -70,11 +70,6 @@ func (pm *Manager) initSpec(p *plugin) (*specs.Spec, error) {
Destination: defaultPluginRuntimeDestination, Destination: defaultPluginRuntimeDestination,
Type: "bind", Type: "bind",
Options: []string{"rbind", "rshared"}, Options: []string{"rbind", "rshared"},
}, types.PluginMount{
Source: &p.stateSourcePath,
Destination: defaultPluginStateDestination,
Type: "bind",
Options: []string{"rbind", "rshared"},
}) })
for _, mount := range mounts { for _, mount := range mounts {
m := specs.Mount{ m := specs.Mount{
@ -105,10 +100,14 @@ func (pm *Manager) initSpec(p *plugin) (*specs.Spec, error) {
envs = append(envs, p.P.Config.Env...) envs = append(envs, p.P.Config.Env...)
args := append(p.P.Manifest.Entrypoint, p.P.Config.Args...) args := append(p.P.Manifest.Entrypoint, p.P.Config.Args...)
cwd := p.P.Manifest.Workdir
if len(cwd) == 0 {
cwd = "/"
}
s.Process = specs.Process{ s.Process = specs.Process{
Terminal: false, Terminal: false,
Args: args, Args: args,
Cwd: "/", // TODO: add in manifest? Cwd: cwd,
Env: envs, Env: envs,
} }