From 50cce6203557886391608557b1ba75056e9452b0 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Tue, 16 May 2023 02:12:02 +0000 Subject: [PATCH] feat: add enablePerformancePlus in storage class fix gofmt fix --- docs/driver-parameters.md | 1 + pkg/azureconstants/azure_constants.go | 1 + pkg/azuredisk/controllerserver.go | 1 + pkg/azuredisk/controllerserver_v2.go | 1 + pkg/azureutils/azure_disk_utils.go | 7 +++++++ test/e2e/dynamic_provisioning_test.go | 7 ++++--- 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/driver-parameters.md b/docs/driver-parameters.md index f898fb68c2..49823a9df7 100644 --- a/docs/driver-parameters.md +++ b/docs/driver-parameters.md @@ -28,6 +28,7 @@ networkAccessPolicy | NetworkAccessPolicy property to prevent anybody from gener publicNetworkAccess | Enabling or disabling public access to the underlying data of a disk on the internet, even when the NetworkAccessPolicy is set to `AllowAll` | `Enabled`, `Disabled` | No | `Enabled` diskAccessID | ARM id of the [DiskAccess](https://aka.ms/disksprivatelinksdoc) resource for using private endpoints on disks | | No | `` enableBursting | [enable on-demand bursting](https://docs.microsoft.com/en-us/azure/virtual-machines/disk-bursting) beyond the provisioned performance target of the disk. On-demand bursting only be applied to Premium disk, disk size > 512GB, Ultra & shared disk is not supported. Bursting is disabled by default. | `true`, `false` | No | `false` +enablePerformancePlus | [enabling performance plus](https://learn.microsoft.com/en-us/azure/virtual-machines/disks-enable-performance), this setting only applies to Premium SSD, Standard SSD and HDD with disk size > 512GB. | `true`, `false` | No | `false` useragent | User agent used for [customer usage attribution](https://docs.microsoft.com/en-us/azure/marketplace/azure-partner-customer-usage-attribution)| | No | Generated Useragent formatted `driverName/driverVersion compiler/version (OS-ARCH)` subscriptionID | specify Azure subscription ID in which Azure disk will be created | Azure subscription ID | No | if not empty, `resourceGroup` must be provided diff --git a/pkg/azureconstants/azure_constants.go b/pkg/azureconstants/azure_constants.go index c366fc086d..397e6c6bd1 100644 --- a/pkg/azureconstants/azure_constants.go +++ b/pkg/azureconstants/azure_constants.go @@ -81,6 +81,7 @@ const ( WriteAcceleratorEnabled = "writeacceleratorenabled" ZonedField = "zoned" EnableAsyncAttachField = "enableasyncattach" + PerformancePlusField = "enableperformanceplus" TooManyRequests = "TooManyRequests" ClientThrottled = "client throttled" VolumeID = "volumeid" diff --git a/pkg/azuredisk/controllerserver.go b/pkg/azuredisk/controllerserver.go index 2ea62ee115..6a55bbcbc3 100644 --- a/pkg/azuredisk/controllerserver.go +++ b/pkg/azuredisk/controllerserver.go @@ -263,6 +263,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) SourceType: sourceType, Tags: diskParams.Tags, Location: diskParams.Location, + PerformancePlus: diskParams.PerformancePlus, } volumeOptions.SkipGetDiskOperation = d.isGetDiskThrottled() diff --git a/pkg/azuredisk/controllerserver_v2.go b/pkg/azuredisk/controllerserver_v2.go index a2dbb31144..3efc67e3b6 100644 --- a/pkg/azuredisk/controllerserver_v2.go +++ b/pkg/azuredisk/controllerserver_v2.go @@ -208,6 +208,7 @@ func (d *DriverV2) CreateVolume(ctx context.Context, req *csi.CreateVolumeReques SourceType: sourceType, Tags: diskParams.Tags, Location: diskParams.Location, + PerformancePlus: diskParams.PerformancePlus, } // Azure Stack Cloud does not support NetworkAccessPolicy, PublicNetworkAccess if !azureutils.IsAzureStackCloud(d.cloud.Config.Cloud, d.cloud.Config.DisableAzureStackCloud) { diff --git a/pkg/azureutils/azure_disk_utils.go b/pkg/azureutils/azure_disk_utils.go index 162ef376be..2aacbf5d71 100644 --- a/pkg/azureutils/azure_disk_utils.go +++ b/pkg/azureutils/azure_disk_utils.go @@ -113,6 +113,7 @@ type ManagedDiskParameters struct { DiskName string EnableAsyncAttach *bool EnableBursting *bool + PerformancePlus *bool FsType string Incremental bool Location string @@ -662,6 +663,12 @@ func ParseDiskParameters(parameters map[string]string) (ManagedDiskParameters, e } case consts.ZonedField: // no op, only for backward compatibility with in-tree driver + case consts.PerformancePlusField: + value, err := strconv.ParseBool(v) + if err != nil { + return diskParams, fmt.Errorf("invalid %s: %s in storage class", consts.PerformancePlusField, v) + } + diskParams.PerformancePlus = &value default: // accept all device settings params // device settings need to start with azureconstants.DeviceSettingsKeyPrefix diff --git a/test/e2e/dynamic_provisioning_test.go b/test/e2e/dynamic_provisioning_test.go index 95a12623c7..1fac52aded 100644 --- a/test/e2e/dynamic_provisioning_test.go +++ b/test/e2e/dynamic_provisioning_test.go @@ -212,9 +212,10 @@ func (t *dynamicProvisioningTestSuite) defineTests(isMultiZone bool) { "skuName": "Premium_LRS", "perfProfile": "Basic", // enableBursting can only be applied to Premium disk, disk size > 512GB, Ultra & shared disk is not supported. - "enableBursting": "true", - "userAgent": "azuredisk-e2e-test", - "enableAsyncAttach": "false", + "enableBursting": "true", + "userAgent": "azuredisk-e2e-test", + "enableAsyncAttach": "false", + "enablePerformancePlus": "true", }, } test.Run(ctx, cs, ns)