fix: windows mount issue

This commit is contained in:
andyzhangx 2020-06-23 07:54:46 +00:00
parent 33a57d4f76
commit a48c41db14
3 changed files with 9 additions and 10 deletions

View File

@ -185,7 +185,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
} }
mountComplete := false mountComplete := false
err = wait.Poll(5*time.Second, 10*time.Minute, func() (bool, error) { err = wait.Poll(5*time.Second, 10*time.Minute, func() (bool, error) {
err := Mount(d.mounter, source, targetPath, "cifs", mountOptions) err := SMBMount(d.mounter, source, targetPath, "cifs", mountOptions)
mountComplete = true mountComplete = true
return true, err return true, err
}) })

View File

@ -24,11 +24,11 @@ import (
"k8s.io/utils/mount" "k8s.io/utils/mount"
) )
func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, options []string) error { func SMBMount(m *mount.SafeFormatAndMount, source, target, fsType string, options []string) error {
return m.Mount(source, target, fsType, options) return m.Mount(source, target, fsType, options)
} }
func Unmount(m *mount.SafeFormatAndMount, target string) error { func SMBUnmount(m *mount.SafeFormatAndMount, target string) error {
return m.Unmount(target) return m.Unmount(target)
} }

View File

@ -21,26 +21,25 @@ package smb
import ( import (
"fmt" "fmt"
"github.com/kubernetes-csi/csi-driver-smb/pkg/mounter"
"k8s.io/klog" "k8s.io/klog"
"k8s.io/utils/mount" "k8s.io/utils/mount"
"github.com/kubernetes-csi/csi-driver-smb/pkg/mounter"
) )
func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, options []string) error { func SMBMount(m *mount.SafeFormatAndMount, source, target, fsType string, options []string) error {
proxy, ok := m.Interface.(*mounter.CSIProxyMounter) proxy, ok := m.Interface.(*mounter.CSIProxyMounter)
if !ok { if !ok {
return fmt.Errorf("could not cast to csi proxy class") return fmt.Errorf("could not cast to csi proxy class")
} }
return proxy.Mount(source, target, fsType, options) return proxy.SMBMount(source, target, fsType, options)
} }
func Unmount(m *mount.SafeFormatAndMount, target string) error { func SMBUnmount(m *mount.SafeFormatAndMount, target string) error {
proxy, ok := m.Interface.(*mounter.CSIProxyMounter) proxy, ok := m.Interface.(*mounter.CSIProxyMounter)
if !ok { if !ok {
return fmt.Errorf("could not cast to csi proxy class") return fmt.Errorf("could not cast to csi proxy class")
} }
return proxy.Unmount(target) return proxy.SMBUnmount(target)
} }
func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error { func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error {
@ -55,7 +54,7 @@ func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error {
// The clean up mount point point calls is supposed for fix the corrupted directories as well. // The clean up mount point point calls is supposed for fix the corrupted directories as well.
// For alpha CSI proxy integration, we only do an unmount. // For alpha CSI proxy integration, we only do an unmount.
func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error {
return Unmount(m, target) return SMBUnmount(m, target)
} }
func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error {