Merge pull request #74499 from andyzhangx/fix-parse-devicePath-issue

fix parse devicePath issue on Azure Disk
pull/564/head
Kubernetes Prow Robot 2019-02-26 00:35:47 -08:00 committed by GitHub
commit b3ca8262be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -165,8 +165,16 @@ func (a *azureDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath string,
nodeName := types.NodeName(a.plugin.host.GetHostName())
diskName := volumeSource.DiskName
var lun int32
if runtime.GOOS == "windows" {
lun := int32(-1)
if runtime.GOOS != "windows" {
// on Linux, usually devicePath is like "/dev/disk/azure/scsi1/lun2", get LUN directly
lun, err = getDiskLUN(devicePath)
if err != nil {
klog.V(2).Infof("azureDisk - WaitForAttach: getDiskLUN(%s) failed with error: %v", devicePath, err)
}
}
if lun < 0 {
klog.V(2).Infof("azureDisk - WaitForAttach: begin to GetDiskLun by diskName(%s), DataDiskURI(%s), nodeName(%s), devicePath(%s)",
diskName, volumeSource.DataDiskURI, nodeName, devicePath)
lun, err = diskController.GetDiskLun(diskName, volumeSource.DataDiskURI, nodeName)
@ -174,11 +182,6 @@ func (a *azureDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath string,
return "", err
}
klog.V(2).Infof("azureDisk - WaitForAttach: GetDiskLun succeeded, got lun(%v)", lun)
} else {
lun, err = getDiskLUN(devicePath)
if err != nil {
return "", err
}
}
exec := a.plugin.host.GetExec(a.plugin.GetPluginName())