mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
fix azure disk attach failure for disk size bigger than 4TB
test: add debugging info fix test failure remove debugging info add condition
This commit is contained in:
parent
fb3e2c42ef
commit
daa4d76643
@ -44,6 +44,9 @@ const (
|
|||||||
maxStorageAccounts = 100 // max # is 200 (250 with special request). this allows 100 for everything else including stand alone disks
|
maxStorageAccounts = 100 // max # is 200 (250 with special request). this allows 100 for everything else including stand alone disks
|
||||||
maxDisksPerStorageAccounts = 60
|
maxDisksPerStorageAccounts = 60
|
||||||
storageAccountUtilizationBeforeGrowing = 0.5
|
storageAccountUtilizationBeforeGrowing = 0.5
|
||||||
|
// 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
|
||||||
|
|
||||||
maxLUN = 64 // max number of LUNs per VM
|
maxLUN = 64 // max number of LUNs per VM
|
||||||
errLeaseFailed = "AcquireDiskLeaseFailed"
|
errLeaseFailed = "AcquireDiskLeaseFailed"
|
||||||
@ -156,10 +159,21 @@ func (c *controllerCommon) AttachDisk(isManagedDisk bool, diskName, diskURI stri
|
|||||||
return -1, danglingErr
|
return -1, danglingErr
|
||||||
}
|
}
|
||||||
|
|
||||||
if disk.DiskProperties != nil && disk.DiskProperties.Encryption != nil &&
|
if disk.DiskProperties != nil {
|
||||||
disk.DiskProperties.Encryption.DiskEncryptionSetID != nil {
|
if disk.DiskProperties.DiskSizeGB != nil && *disk.DiskProperties.DiskSizeGB >= diskCachingLimit && cachingMode != compute.CachingTypesNone {
|
||||||
diskEncryptionSetID = *disk.DiskProperties.Encryption.DiskEncryptionSetID
|
// 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := disk.Tags[WriteAcceleratorEnabled]; ok {
|
if v, ok := disk.Tags[WriteAcceleratorEnabled]; ok {
|
||||||
if v != nil && strings.EqualFold(*v, "true") {
|
if v != nil && strings.EqualFold(*v, "true") {
|
||||||
writeAcceleratorEnabled = true
|
writeAcceleratorEnabled = true
|
||||||
|
@ -77,10 +77,15 @@ func TestCommonAttachDisk(t *testing.T) {
|
|||||||
expectedErr: true,
|
expectedErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "correct LUN and no error shall be returned if everything is good",
|
desc: "correct LUN and no error shall be returned if everything is good",
|
||||||
vmList: map[string]string{"vm1": "PowerState/Running"},
|
vmList: map[string]string{"vm1": "PowerState/Running"},
|
||||||
nodeName: "vm1",
|
nodeName: "vm1",
|
||||||
existedDisk: compute.Disk{Name: to.StringPtr("disk-name"), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &diskEncryptionSetID, Type: compute.EncryptionAtRestWithCustomerKey}}, Tags: testTags},
|
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},
|
||||||
expectedLun: 1,
|
expectedLun: 1,
|
||||||
expectedErr: false,
|
expectedErr: false,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user