Abstract ismountpoint and use platform mounter for NFS volume

This commit is contained in:
Deyuan Deng
2015-03-31 22:08:33 -04:00
committed by Deyuan Deng
parent 2de37624e8
commit d62afa85ff
12 changed files with 70 additions and 92 deletions

View File

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

View File

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