Merge pull request #61147 from mlmhl/csi

Automatic merge from submit-queue (batch tested with PRs 61147, 62236, 62018). 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>.

Return NodeStageVolume/NodePublishVolume error if operation failed for CSI

**What this PR does / why we need it**:

Currently in CSI volume plugin, if `NodeStageVolume`/`NodePublishVolume` operation failed, we will try to remove according target dir(global mount path or pod volume path) first. If this clear operation failed, according error will be returned, and finally displayed in `Pod`'s event. However, compared to this clear error, the user is more concerned about `NodeStageVolume`/`NodePublishVolume` error, so I suggest that just log the clear error and still return the `NodeStageVolume`/`NodePublishVolume` error.

**Release note**:

```release-note
NONE
```

/sig storage
pull/8/head
Kubernetes Submit Queue 2018-04-10 05:31:13 -07:00 committed by GitHub
commit 89d8884fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -356,9 +356,8 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo
if err != nil {
glog.Errorf(log("attacher.MountDevice failed: %v", err))
if err := removeMountDir(c.plugin, deviceMountPath); err != nil {
glog.Error(log("attacher.MountDevice failed to remove mount dir after a NodeStageVolume() error [%s]: %v", deviceMountPath, err))
return err
if removeMountDirErr := removeMountDir(c.plugin, deviceMountPath); removeMountDirErr != nil {
glog.Error(log("attacher.MountDevice failed to remove mount dir after a NodeStageVolume() error [%s]: %v", deviceMountPath, removeMountDirErr))
}
return err
}

View File

@ -213,9 +213,8 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
if err != nil {
glog.Errorf(log("mounter.SetupAt failed: %v", err))
if err := removeMountDir(c.plugin, dir); err != nil {
glog.Error(log("mounter.SetuAt failed to remove mount dir after a NodePublish() error [%s]: %v", dir, err))
return err
if removeMountDirErr := removeMountDir(c.plugin, dir); removeMountDirErr != nil {
glog.Error(log("mounter.SetupAt failed to remove mount dir after a NodePublish() error [%s]: %v", dir, removeMountDirErr))
}
return err
}