浏览代码

Merge pull request #13586 from kvasdopil/zfs-88chars

Avoid 88-chars mountpoint length limit on freebsd
Alexander Morozov 10 年之前
父节点
当前提交
9069cded57

+ 1 - 1
daemon/graphdriver/zfs/zfs.go

@@ -212,7 +212,7 @@ func (d *Driver) ZfsPath(id string) string {
 }
 
 func (d *Driver) MountPath(id string) string {
-	return path.Join(d.options.mountPath, "graph", id)
+	return path.Join(d.options.mountPath, "graph", getMountpoint(id))
 }
 
 func (d *Driver) Create(id string, parent string) error {

+ 14 - 0
daemon/graphdriver/zfs/zfs_freebsd.go

@@ -2,6 +2,7 @@ package zfs
 
 import (
 	"fmt"
+	"strings"
 	"syscall"
 
 	log "github.com/Sirupsen/logrus"
@@ -22,3 +23,16 @@ func checkRootdirFs(rootdir string) error {
 
 	return nil
 }
+
+func getMountpoint(id string) string {
+	maxlen := 12
+
+	// we need to preserve filesystem suffix
+	suffix := strings.SplitN(id, "-", 2)
+
+	if len(suffix) > 1 {
+		return id[:maxlen] + "-" + suffix[1]
+	}
+
+	return id[:maxlen]
+}

+ 4 - 0
daemon/graphdriver/zfs/zfs_linux.go

@@ -21,3 +21,7 @@ func checkRootdirFs(rootdir string) error {
 
 	return nil
 }
+
+func getMountpoint(id string) string {
+	return id
+}

+ 4 - 0
daemon/graphdriver/zfs/zfs_unsupported.go

@@ -5,3 +5,7 @@ package zfs
 func checkRootdirFs(rootdir string) error {
 	return nil
 }
+
+func getMountpoint(id string) string {
+	return id
+}