Unverified Commit b95ae931 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #61389 from linyouchong/linyouchong-20180320

Automatic merge from submit-queue. 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>. csiAttacher: check deviceMountPath before hasStageUnstageCapability csiAttacher#MountDevice: it is better to check `deviceMountPath` before `hasStageUnstageCapability` **Release note**: ``` NONE ``` /release-note-none /kind cleanup /sig storage
parents 5b82745c 51e81d25
...@@ -248,6 +248,11 @@ func (c *csiAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error) { ...@@ -248,6 +248,11 @@ func (c *csiAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error) {
func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) (err error) { func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) (err error) {
glog.V(4).Infof(log("attacher.MountDevice(%s, %s)", devicePath, deviceMountPath)) glog.V(4).Infof(log("attacher.MountDevice(%s, %s)", devicePath, deviceMountPath))
if deviceMountPath == "" {
err = fmt.Errorf("attacher.MountDevice failed, deviceMountPath is empty")
return err
}
mounted, err := isDirMounted(c.plugin, deviceMountPath) mounted, err := isDirMounted(c.plugin, deviceMountPath)
if err != nil { if err != nil {
glog.Error(log("attacher.MountDevice failed while checking mount status for dir [%s]", deviceMountPath)) glog.Error(log("attacher.MountDevice failed while checking mount status for dir [%s]", deviceMountPath))
...@@ -317,11 +322,6 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo ...@@ -317,11 +322,6 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo
} }
// Start MountDevice // Start MountDevice
if deviceMountPath == "" {
err = fmt.Errorf("attacher.MountDevice failed, deviceMountPath is empty")
return err
}
nodeName := string(c.plugin.host.GetNodeName()) nodeName := string(c.plugin.host.GetNodeName())
attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, nodeName) attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, nodeName)
......
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