Commit 9d207b3e authored by David Zhu's avatar David Zhu

GetMountRefs should not fail if the path supplied does not exist anymore. It has…

GetMountRefs should not fail if the path supplied does not exist anymore. It has no mount references
parent 44be42c1
......@@ -1005,6 +1005,9 @@ func (mounter *Mounter) SafeMakeDir(subdir string, base string, perm os.FileMode
}
func (mounter *Mounter) GetMountRefs(pathname string) ([]string, error) {
if _, err := os.Stat(pathname); os.IsNotExist(err) {
return []string{}, nil
}
realpath, err := filepath.EvalSymlinks(pathname)
if err != nil {
return nil, err
......
......@@ -1433,6 +1433,8 @@ func isDeviceOpened(deviceToDetach AttachedVolume, mounter mount.Interface) (boo
//TODO: refer to #36092
glog.V(3).Infof("The path isn't device path or doesn't exist. Skip checking device path: %s", deviceToDetach.DevicePath)
deviceOpened = false
} else if devicePathErr != nil {
return false, deviceToDetach.GenerateErrorDetailed("PathIsDevice failed", devicePathErr)
} else {
deviceOpened, deviceOpenedErr = mounter.DeviceOpened(deviceToDetach.DevicePath)
if deviceOpenedErr != nil {
......
......@@ -281,7 +281,7 @@ func tearDownTestCase(c clientset.Interface, f *framework.Framework, ns string,
// Ignore deletion errors. Failing on them will interrupt test cleanup.
framework.DeletePodWithWait(f, c, client)
framework.DeletePersistentVolumeClaim(c, pvc.Name, ns)
if forceDeletePV {
if forceDeletePV && pv != nil {
framework.DeletePersistentVolume(c, pv.Name)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment