mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	plugins: remove automatic mounting of a state dir
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
		
							parent
							
								
									4b70d4561e
								
							
						
					
					
						commit
						15ff9de658
					
				
					 2 changed files with 6 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -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()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue