@@ -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 .
797792func (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.
820815func (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