diff options
Diffstat (limited to 'pkg/driver/volume.go')
| -rw-r--r-- | pkg/driver/volume.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/pkg/driver/volume.go b/pkg/driver/volume.go index ff303ea..5358700 100644 --- a/pkg/driver/volume.go +++ b/pkg/driver/volume.go @@ -9,7 +9,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/pb/mount_pb" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "k8s.io/utils/mount" + "k8s.io/mount-utils" ) type Volume struct { @@ -32,11 +32,11 @@ func NewVolume(volumeID string, mounter Mounter) *Volume { func (vol *Volume) Stage(stagingTargetPath string) error { // check whether it can be mounted - if notMnt, err := checkMount(stagingTargetPath); err != nil { + if isMnt, err := checkMount(stagingTargetPath); err != nil { return err - } else if !notMnt { + } else if isMnt { // try to unmount before mounting again - _ = mount.New("").Unmount(stagingTargetPath) + _ = mountutil.Unmount(stagingTargetPath) } if u, err := vol.mounter.Mount(stagingTargetPath); err == nil { @@ -49,9 +49,9 @@ func (vol *Volume) Stage(stagingTargetPath string) error { func (vol *Volume) Publish(stagingTargetPath string, targetPath string, readOnly bool) error { // check whether it can be mounted - if notMnt, err := checkMount(targetPath); err != nil { + if isMnt, err := checkMount(targetPath); err != nil { return err - } else if !notMnt { + } else if isMnt { // maybe already mounted? return nil } @@ -62,8 +62,7 @@ func (vol *Volume) Publish(stagingTargetPath string, targetPath string, readOnly mountOptions = append(mountOptions, "ro") } - mounter := mount.New("") - if err := mounter.Mount(stagingTargetPath, targetPath, "", mountOptions); err != nil { + if err := mountutil.Mount(stagingTargetPath, targetPath, "", mountOptions); err != nil { return err } @@ -89,8 +88,7 @@ func (vol *Volume) Expand(sizeByte int64) error { func (vol *Volume) Unpublish(targetPath string) error { // Try unmounting target path and deleting it. - mounter := mount.New("") - if err := mount.CleanupMountPoint(targetPath, mounter, true); err != nil { + if err := mount.CleanupMountPoint(targetPath, mountutil, true); err != nil { return err } |
