Skip to content

Commit

Permalink
Merge pull request #81832 from andyzhangx/automated-cherry-pick-of-#8…
Browse files Browse the repository at this point in the history
…1720-upstream-release-1.13

Automated cherry pick of #81720: fix: azure disk name matching issue
  • Loading branch information
k8s-ci-robot committed Aug 30, 2019
2 parents 7237839 + f388888 commit d2b5bba
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/cloudprovider/providers/azure/azure_controller_common.go
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"path"
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute"
Expand Down Expand Up @@ -205,9 +206,9 @@ func (c *controllerCommon) GetDiskLun(diskName, diskURI string, nodeName types.N
}

for _, disk := range disks {
if disk.Lun != nil && (disk.Name != nil && diskName != "" && *disk.Name == diskName) ||
(disk.Vhd != nil && disk.Vhd.URI != nil && diskURI != "" && *disk.Vhd.URI == diskURI) ||
(disk.ManagedDisk != nil && *disk.ManagedDisk.ID == diskURI) {
if disk.Lun != nil && (disk.Name != nil && diskName != "" && strings.EqualFold(*disk.Name, diskName)) ||
(disk.Vhd != nil && disk.Vhd.URI != nil && diskURI != "" && strings.EqualFold(*disk.Vhd.URI, diskURI)) ||
(disk.ManagedDisk != nil && strings.EqualFold(*disk.ManagedDisk.ID, diskURI)) {
// found the disk
klog.V(2).Infof("azureDisk - find disk: lun %d name %q uri %q", *disk.Lun, diskName, diskURI)
return *disk.Lun, nil
Expand Down Expand Up @@ -259,7 +260,7 @@ func (c *controllerCommon) DisksAreAttached(diskNames []string, nodeName types.N

for _, disk := range disks {
for _, diskName := range diskNames {
if disk.Name != nil && diskName != "" && *disk.Name == diskName {
if disk.Name != nil && diskName != "" && strings.EqualFold(*disk.Name, diskName) {
attached[diskName] = true
}
}
Expand Down

0 comments on commit d2b5bba

Please sign in to comment.