Abstract ismountpoint and use platform mounter for NFS volume
This commit is contained in:
@@ -183,7 +183,7 @@ func (pd *gcePersistentDisk) SetUpAt(dir string) error {
|
||||
}
|
||||
|
||||
// TODO: handle failed mounts here.
|
||||
mountpoint, err := mount.IsMountPoint(dir)
|
||||
mountpoint, err := pd.mounter.IsMountPoint(dir)
|
||||
glog.V(4).Infof("PersistentDisk set up: %s %v %v", dir, mountpoint, err)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
@@ -211,7 +211,7 @@ func (pd *gcePersistentDisk) SetUpAt(dir string) error {
|
||||
// Perform a bind mount to the full path to allow duplicate mounts of the same PD.
|
||||
err = pd.mounter.Mount(globalPDPath, dir, "", mount.FlagBind|flags, "")
|
||||
if err != nil {
|
||||
mountpoint, mntErr := mount.IsMountPoint(dir)
|
||||
mountpoint, mntErr := pd.mounter.IsMountPoint(dir)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("isMountpoint check failed: %v", mntErr)
|
||||
return err
|
||||
@@ -221,7 +221,7 @@ func (pd *gcePersistentDisk) SetUpAt(dir string) error {
|
||||
glog.Errorf("Failed to unmount: %v", mntErr)
|
||||
return err
|
||||
}
|
||||
mountpoint, mntErr := mount.IsMountPoint(dir)
|
||||
mountpoint, mntErr := pd.mounter.IsMountPoint(dir)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("isMountpoint check failed: %v", mntErr)
|
||||
return err
|
||||
@@ -262,7 +262,7 @@ func (pd *gcePersistentDisk) TearDown() error {
|
||||
// Unmounts the bind mount, and detaches the disk only if the PD
|
||||
// resource was the last reference to that disk on the kubelet.
|
||||
func (pd *gcePersistentDisk) TearDownAt(dir string) error {
|
||||
mountpoint, err := mount.IsMountPoint(dir)
|
||||
mountpoint, err := pd.mounter.IsMountPoint(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -287,7 +287,7 @@ func (pd *gcePersistentDisk) TearDownAt(dir string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
mountpoint, mntErr := mount.IsMountPoint(dir)
|
||||
mountpoint, mntErr := pd.mounter.IsMountPoint(dir)
|
||||
if mntErr != nil {
|
||||
glog.Errorf("isMountpoint check failed: %v", mntErr)
|
||||
return err
|
||||
|
@@ -68,7 +68,7 @@ func (util *GCEDiskUtil) AttachAndMountDisk(pd *gcePersistentDisk, globalPDPath
|
||||
}
|
||||
|
||||
// Only mount the PD globally once.
|
||||
mountpoint, err := mount.IsMountPoint(globalPDPath)
|
||||
mountpoint, err := pd.mounter.IsMountPoint(globalPDPath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(globalPDPath, 0750); err != nil {
|
||||
|
Reference in New Issue
Block a user