avoid 88-chars mountpoint length limit on freebsd

Signed-off-by: Alexey Guskov <lexag@mail.ru>
This commit is contained in:
Alexey Guskov 2015-05-29 16:33:04 +03:00
parent 7f6a7973cd
commit 112b7e6546
4 changed files with 23 additions and 1 deletions

View File

@ -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 {

View File

@ -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]
}

View File

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

View File

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