mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #54271 from linyouchong/linyouchong-20171020
Automatic merge from submit-queue (batch tested with PRs 54081, 54271, 51783, 54600, 54594). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Remove redundant code of checking path **What this PR does / why we need it**: Remove redundant code of checking path the checking is not necessary here,WrapperUnmounter#TearDownAt always do that func UnmountViaEmptyDir(dir string, host VolumeHost, volName string, volSpec Spec, podUID types.UID) error { glog.V(3).Infof("Tearing down volume %v for pod %v at %v", volName, podUID, dir) if pathExists, pathErr := volutil.PathExists(dir); pathErr != nil { return fmt.Errorf("Error checking if path exists: %v", pathErr) } else if !pathExists { glog.Warningf("Warning: Unmount skipped because path does not exist: %v", dir) return nil } // Wrap EmptyDir, let it do the teardown. wrapped, err := host.NewWrapperUnmounter(volName, volSpec, podUID) if err != nil { return err } return wrapped.TearDownAt(dir) } **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # NONE **Release note**: NONE
This commit is contained in:
commit
a0aee05376
@ -36,7 +36,6 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
volutil "k8s.io/kubernetes/pkg/volume/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RecycleEventRecorder func(eventtype, message string)
|
type RecycleEventRecorder func(eventtype, message string)
|
||||||
@ -424,13 +423,6 @@ func getPVCNameHashAndIndexOffset(pvcName string) (hash uint32, index uint32) {
|
|||||||
func UnmountViaEmptyDir(dir string, host VolumeHost, volName string, volSpec Spec, podUID types.UID) error {
|
func UnmountViaEmptyDir(dir string, host VolumeHost, volName string, volSpec Spec, podUID types.UID) error {
|
||||||
glog.V(3).Infof("Tearing down volume %v for pod %v at %v", volName, podUID, dir)
|
glog.V(3).Infof("Tearing down volume %v for pod %v at %v", volName, podUID, dir)
|
||||||
|
|
||||||
if pathExists, pathErr := volutil.PathExists(dir); pathErr != nil {
|
|
||||||
return fmt.Errorf("Error checking if path exists: %v", pathErr)
|
|
||||||
} else if !pathExists {
|
|
||||||
glog.Warningf("Warning: Unmount skipped because path does not exist: %v", dir)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wrap EmptyDir, let it do the teardown.
|
// Wrap EmptyDir, let it do the teardown.
|
||||||
wrapped, err := host.NewWrapperUnmounter(volName, volSpec, podUID)
|
wrapped, err := host.NewWrapperUnmounter(volName, volSpec, podUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user