Browse code

Add Windows specific exec root for plugins.

Fixes #30572

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>

Anusha Ragunathan authored on 2017/02/03 04:22:12
Showing 3 changed files
... ...
@@ -569,7 +569,7 @@ func NewDaemon(config *Config, registryService registry.Service, containerdRemot
569 569
 	// Plugin system initialization should happen before restore. Do not change order.
570 570
 	d.pluginManager, err = plugin.NewManager(plugin.ManagerConfig{
571 571
 		Root:               filepath.Join(config.Root, "plugins"),
572
-		ExecRoot:           "/run/docker/plugins", // possibly needs fixing
572
+		ExecRoot:           getPluginExecRoot(config.Root),
573 573
 		Store:              d.PluginStore,
574 574
 		Executor:           containerdRemote,
575 575
 		RegistryService:    registryService,
... ...
@@ -12,6 +12,14 @@ import (
12 12
 	"github.com/docker/docker/pkg/mount"
13 13
 )
14 14
 
15
+// On Linux, plugins use a static path for storing execution state,
16
+// instead of deriving path from daemon's exec-root. This is because
17
+// plugin socket files are created here and they cannot exceed max
18
+// path length of 108 bytes.
19
+func getPluginExecRoot(root string) string {
20
+	return "/run/docker/plugins"
21
+}
22
+
15 23
 func (daemon *Daemon) cleanupMountsByID(id string) error {
16 24
 	logrus.Debugf("Cleaning up old mountid %s: start.", id)
17 25
 	f, err := os.Open("/proc/self/mountinfo")
... ...
@@ -3,6 +3,7 @@ package daemon
3 3
 import (
4 4
 	"fmt"
5 5
 	"os"
6
+	"path/filepath"
6 7
 	"strings"
7 8
 
8 9
 	"github.com/Microsoft/hcsshim"
... ...
@@ -37,6 +38,11 @@ const (
37 37
 	windowsMinCPUCount   = 1
38 38
 )
39 39
 
40
+// Windows has no concept of an execution state directory. So use config.Root here.
41
+func getPluginExecRoot(root string) string {
42
+	return filepath.Join(root, "plugins")
43
+}
44
+
40 45
 func getBlkioWeightDevices(config *containertypes.HostConfig) ([]blkiodev.WeightDevice, error) {
41 46
 	return nil, nil
42 47
 }