From 23dbd69925b6c199e8b659c98089ba00389ce5ea Mon Sep 17 00:00:00 2001 From: mlmhl Date: Wed, 14 Mar 2018 09:47:43 +0800 Subject: [PATCH] return NodeStageVolume/NodePublishVolume error if operation failed --- pkg/volume/csi/csi_attacher.go | 5 ++--- pkg/volume/csi/csi_mounter.go | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/volume/csi/csi_attacher.go b/pkg/volume/csi/csi_attacher.go index 720cbce04da..a5a869184d1 100644 --- a/pkg/volume/csi/csi_attacher.go +++ b/pkg/volume/csi/csi_attacher.go @@ -352,9 +352,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 } diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index 213d0b58200..090f174515c 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -207,9 +207,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 }