daemon: getPluginExecRoot(): pass config

This makes it more transparent that it's unused for Linux,
and we don't pass "root", which has no relation with the
path on Linux.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-10-17 13:47:56 +02:00
parent d006242d73
commit 19c5d21e6f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 5 additions and 5 deletions

View File

@ -903,13 +903,13 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
} }
rt = *rtPtr rt = *rtPtr
} }
return pluginexec.New(ctx, getPluginExecRoot(config.Root), pluginCli, config.ContainerdPluginNamespace, m, rt) return pluginexec.New(ctx, getPluginExecRoot(config), pluginCli, config.ContainerdPluginNamespace, m, rt)
} }
// Plugin system initialization should happen before restore. Do not change order. // Plugin system initialization should happen before restore. Do not change order.
d.pluginManager, err = plugin.NewManager(plugin.ManagerConfig{ d.pluginManager, err = plugin.NewManager(plugin.ManagerConfig{
Root: filepath.Join(config.Root, "plugins"), Root: filepath.Join(config.Root, "plugins"),
ExecRoot: getPluginExecRoot(config.Root), ExecRoot: getPluginExecRoot(config),
Store: d.PluginStore, Store: d.PluginStore,
CreateExecutor: createPluginExec, CreateExecutor: createPluginExec,
RegistryService: registryService, RegistryService: registryService,

View File

@ -20,7 +20,7 @@ import (
// instead of deriving path from daemon's exec-root. This is because // instead of deriving path from daemon's exec-root. This is because
// plugin socket files are created here and they cannot exceed max // plugin socket files are created here and they cannot exceed max
// path length of 108 bytes. // path length of 108 bytes.
func getPluginExecRoot(root string) string { func getPluginExecRoot(_ *config.Config) string {
return "/run/docker/plugins" return "/run/docker/plugins"
} }

View File

@ -55,8 +55,8 @@ func adjustParallelLimit(n int, limit int) int {
} }
// Windows has no concept of an execution state directory. So use config.Root here. // Windows has no concept of an execution state directory. So use config.Root here.
func getPluginExecRoot(root string) string { func getPluginExecRoot(cfg *config.Config) string {
return filepath.Join(root, "plugins") return filepath.Join(cfg.Root, "plugins")
} }
func (daemon *Daemon) parseSecurityOpt(container *container.Container, hostConfig *containertypes.HostConfig) error { func (daemon *Daemon) parseSecurityOpt(container *container.Container, hostConfig *containertypes.HostConfig) error {