Skip to content

Commit

Permalink
fix attach bug
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Dec 15, 2020
1 parent d2364fa commit a744f78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ func (as *availabilitySet) AttachDisk(nodeName types.NodeName, diskMap map[strin

for diskURI, opt := range diskMap {
if opt.isManagedDisk {
attached := false
for _, disk := range disks {
if disk.ManagedDisk != nil && strings.EqualFold(*disk.ManagedDisk.ID, diskURI) {
attached = true
break
}
}
if attached {
klog.V(2).Infof("azureDisk - disk(%s) already attached to node(%s)", diskURI, nodeName)
continue
}

managedDisk := &compute.ManagedDiskParameters{ID: &diskURI}
if opt.diskEncryptionSetID == "" {
if vm.StorageProfile.OsDisk != nil &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (ss *scaleSet) AttachDisk(nodeName types.NodeName, diskMap map[string]*Atta
}
if attached {
klog.V(2).Infof("azureDisk - disk(%s) already attached to node(%s)", diskURI, nodeName)
return nil
continue
}

managedDisk := &compute.ManagedDiskParameters{ID: &diskURI}
Expand Down

0 comments on commit a744f78

Please sign in to comment.