Skip to content

Commit 23f3d43

Browse files
authored
ANF manual QoS
1 parent 4f22e27 commit 23f3d43

File tree

11 files changed

+267
-51
lines changed

11 files changed

+267
-51
lines changed

mocks/mock_operator/mock_controllers/mock_orchestrator/mock_installer/mock_installer.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mocks/mock_storage_drivers/mock_azure/mock_api.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storage_drivers/azure/api/azure.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ func (c Client) newFileSystemFromVolume(ctx context.Context, vol *netapp.Volume)
650650
KerberosEnabled: DerefBool(vol.Properties.KerberosEnabled),
651651
KeyVaultEndpointID: DerefString(vol.Properties.KeyVaultPrivateEndpointResourceID),
652652
Zones: DerefStringPtrArray(vol.Zones),
653+
MaxThroughput: DerefFloat32(vol.Properties.ThroughputMibps),
653654
}, nil
654655
}
655656

@@ -1033,6 +1034,11 @@ func (c Client) CreateVolume(ctx context.Context, request *FilesystemCreateReque
10331034
newVol.Properties.KeyVaultPrivateEndpointResourceID = &request.KeyVaultEndpointID
10341035
}
10351036

1037+
// Only set the max throughput if specified
1038+
if request.MaxThroughput != nil {
1039+
newVol.Properties.ThroughputMibps = request.MaxThroughput
1040+
}
1041+
10361042
Logc(ctx).WithFields(LogFields{
10371043
"name": request.Name,
10381044
"creationToken": request.CreationToken,
@@ -1748,6 +1754,14 @@ func DerefInt64(i *int64) int64 {
17481754
return 0
17491755
}
17501756

1757+
// DerefFloat32 accepts a float32 pointer and returns the value of the float32, or 0 if the pointer is nil.
1758+
func DerefFloat32(i *float32) float32 {
1759+
if i != nil {
1760+
return *i
1761+
}
1762+
return float32(0)
1763+
}
1764+
17511765
// DerefNetworkFeatures accepts a NetworkFeatures pointer and returns its string value, or "" if the pointer is nil.
17521766
func DerefNetworkFeatures(f *netapp.NetworkFeatures) string {
17531767
if f != nil {

storage_drivers/azure/api/azure_discovery.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"time"
1212

1313
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
14-
netapp "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v7"
1514
resourcegraph "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph"
1615
features "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures"
1716
"github.com/cenkalti/backoff/v4"
@@ -31,6 +30,7 @@ const (
3130
resourceGroups = "resourceGroups"
3231
netappAccounts = "netappAccounts"
3332
capacityPools = "capacityPools"
33+
qosType = "qosType"
3434
DefaultMaxCacheAge = 10 * time.Minute
3535
)
3636

@@ -244,7 +244,8 @@ func (c Client) checkForUnsatisfiedPools(ctx context.Context) (discoveryErrors [
244244
for sPoolName, sPool := range c.sdkClient.AzureResources.StoragePoolMap {
245245

246246
// Find all capacity pools that work for this storage pool
247-
cPools := c.CapacityPoolsForStoragePool(ctx, sPool, sPool.InternalAttributes()[serviceLevel])
247+
cPools := c.CapacityPoolsForStoragePool(ctx, sPool,
248+
sPool.InternalAttributes()[serviceLevel], sPool.InternalAttributes()[qosType])
248249

249250
if len(cPools) == 0 {
250251

@@ -615,12 +616,6 @@ func (c Client) discoverCapacityPools(ctx context.Context) (*[]*CapacityPool, er
615616
continue
616617
}
617618

618-
if qosType == string(netapp.QosTypeManual) {
619-
Logc(ctx).WithFields(logFields).Warningf("Ignoring capacity pool %s because it uses manual QoS.",
620-
cPoolFullName)
621-
continue
622-
}
623-
624619
if poolID, ok = rawProperties["poolId"].(string); !ok {
625620
Logc(ctx).WithFields(logFields).Error("Capacity pool query returned invalid poolId.")
626621
continue
@@ -793,14 +788,14 @@ func (c Client) capacityPool(cPoolFullName string) *CapacityPool {
793788
}
794789

795790
// CapacityPoolsForStoragePools returns all discovered capacity pools matching all known storage pools,
796-
// regardless of service levels.
791+
// regardless of service levels or QOS types.
797792
func (c Client) CapacityPoolsForStoragePools(ctx context.Context) []*CapacityPool {
798793
// This map deduplicates cPools from multiple storage pools
799794
cPoolMap := make(map[*CapacityPool]bool)
800795

801796
// Build deduplicated map of cPools
802797
for _, sPool := range c.sdkClient.StoragePoolMap {
803-
for _, cPool := range c.CapacityPoolsForStoragePool(ctx, sPool, "") {
798+
for _, cPool := range c.CapacityPoolsForStoragePool(ctx, sPool, "", "") {
804799
cPoolMap[cPool] = true
805800
}
806801
}
@@ -818,7 +813,7 @@ func (c Client) CapacityPoolsForStoragePools(ctx context.Context) []*CapacityPoo
818813
// CapacityPoolsForStoragePool returns all discovered capacity pools matching the specified
819814
// storage pool and service level. The pools are shuffled to enable easier random selection.
820815
func (c Client) CapacityPoolsForStoragePool(
821-
ctx context.Context, sPool storage.Pool, serviceLevel string,
816+
ctx context.Context, sPool storage.Pool, serviceLevel, qosType string,
822817
) []*CapacityPool {
823818
Logd(ctx, c.config.StorageDriverName, c.config.DebugTraceFlags["discovery"]).WithField("storagePool", sPool.Name()).
824819
Tracef("Determining capacity pools for storage pool.")
@@ -880,6 +875,17 @@ func (c Client) CapacityPoolsForStoragePool(
880875
}
881876
}
882877

878+
// Filter out pools with non-matching QOS type
879+
if qosType != "" {
880+
for cPoolFullName, cPool := range c.sdkClient.CapacityPoolMap {
881+
if cPool.QosType != qosType {
882+
Logd(ctx, c.config.StorageDriverName, c.config.DebugTraceFlags["discovery"]).Tracef("Ignoring capacity pool %s, not QOS type %s.",
883+
cPoolFullName, qosType)
884+
filteredCapacityPoolMap[cPoolFullName] = false
885+
}
886+
}
887+
}
888+
883889
// Build list of all capacity pools that have passed all filters
884890
cPools := make([]*CapacityPool, 0)
885891
for cPoolFullName, match := range filteredCapacityPoolMap {

0 commit comments

Comments
 (0)