Change:
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks! If the matter is security related, please disclose it privately via --What happened: there is a disk resize scenario: In the beginning, it’s 3TiB with cachingMode=ReadOnly, and then disk detached, resized to 4TiB, then user find they could not attach that disk back to any agent node, I think that’s a bug we need to fix. What you expected to happen: How to reproduce it (as minimally and precisely as possible): Anything else we need to know?: Environment: Kubernetes version (use ): Cloud provider or hardware configuration: OS (e.g: ): Kernel (e.g. ): Install tools: Network plugin and version (if this is a network-related bug): Others: /kind bug /assign /priority important-soon /sig cloud-provider /area provider/azure
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details

Discussion:
maxStorageAccounts                     = 100 // max # is 200 (250 with special request). this allows 100 for everything else including stand alone disks maxDisksPerStorageAccounts             = 60 storageAccountUtilizationBeforeGrowing = 0.5 <ins> // Disk Caching is not supported for disks 4 TiB and larger // https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#disk-caching diskCachingLimit = 4096 // GiB </ins> maxLUN               = 64 // max number of LUNs per VM errLeaseFailed       = "AcquireDiskLeaseFailed"

return -1, danglingErr } <del> if disk.DiskProperties != nil && disk.DiskProperties.Encryption != nil && disk.DiskProperties.Encryption.DiskEncryptionSetID != nil { diskEncryptionSetID = *disk.DiskProperties.Encryption.DiskEncryptionSetID </del> <ins> if disk.DiskProperties != nil { if disk.DiskProperties.DiskSizeGB != nil && *disk.DiskProperties.DiskSizeGB >= diskCachingLimit && cachingMode != compute.CachingTypesNone { // Disk Caching is not supported for disks 4 TiB and larger // https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#disk-caching cachingMode = compute.CachingTypesNone klog.Warningf("size of disk(%s) is %dGB which is bigger than limit(%dGB), set cacheMode as None", diskURI, *disk.DiskProperties.DiskSizeGB, diskCachingLimit) } if disk.DiskProperties.Encryption != nil && disk.DiskProperties.Encryption.DiskEncryptionSetID != nil { diskEncryptionSetID = *disk.DiskProperties.Encryption.DiskEncryptionSetID } </ins> } if v, ok := disk.Tags[WriteAcceleratorEnabled]; ok { if v != nil && strings.EqualFold(*v, "true") { writeAcceleratorEnabled = true

expectedErr:     true, }, { <del> desc:        "correct LUN and no error shall be returned if everything is good", vmList:      map[string]string{"vm1": "PowerState/Running"}, nodeName:    "vm1", existedDisk: compute.Disk{Name: to.StringPtr("disk-name"), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &diskEncryptionSetID, Type: compute.EncryptionAtRestWithCustomerKey}}, Tags: testTags}, </del> <ins> desc:     "correct LUN and no error shall be returned if everything is good", vmList:   map[string]string{"vm1": "PowerState/Running"}, nodeName: "vm1", existedDisk: compute.Disk{Name: to.StringPtr("disk-name"), DiskProperties: &compute.DiskProperties{ Encryption: &compute.Encryption{DiskEncryptionSetID: &diskEncryptionSetID, Type: compute.EncryptionAtRestWithCustomerKey}, DiskSizeGB: to.Int32Ptr(4096), }, Tags: testTags}, </ins> expectedLun: 1, expectedErr: false, },