mirror of https://github.com/k3s-io/k3s
GetMountRefs should not fail if the path supplied does not exist anymore. It has no mount references
parent
44be42c196
commit
9d207b3e3c
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue