From d3d301886063aee4040c483bb8365119909e1aef Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Mon, 2 Apr 2018 08:15:30 +0000 Subject: [PATCH] fix local volume issue on windows --- pkg/volume/local/local.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/volume/local/local.go b/pkg/volume/local/local.go index 88fd34c7a14..5f6916eb485 100644 --- a/pkg/volume/local/local.go +++ b/pkg/volume/local/local.go @@ -20,6 +20,7 @@ import ( "fmt" "os" "path" + "runtime" "github.com/golang/glog" @@ -296,11 +297,13 @@ func (m *localVolumeMounter) SetUpAt(dir string, fsGroup *int64) error { } - if err := os.MkdirAll(dir, 0750); err != nil { - glog.Errorf("mkdir failed on disk %s (%v)", dir, err) - return err + if runtime.GOOS != "windows" { + // skip below MkdirAll for windows since the "bind mount" logic is implemented differently in mount_wiondows.go + if err := os.MkdirAll(dir, 0750); err != nil { + glog.Errorf("mkdir failed on disk %s (%v)", dir, err) + return err + } } - // Perform a bind mount to the full path to allow duplicate mounts of the same volume. options := []string{"bind"} if m.readOnly {