Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitRoushan committed Aug 24, 2021
1 parent d9e6e85 commit 605caf2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/csi/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
{"qos", filterByQos},
{"hyperMetro", filterByMetro},
{"replication", filterByReplication},
{"topologyRequirement", filterByTopology},
{TopologyRequirement, filterByTopology},
}

secondaryFilterFuncs = [][]interface{}{
Expand Down Expand Up @@ -291,11 +291,13 @@ func selectOnePool(requestSize int64,

for _, i := range filterFuncs {
key, filter := i[0].(string), i[1].(FilterFunction)
value, _ := parameters[key].(string)
filterPools = filter(value, filterPools)
if len(filterPools) == 0 {
return nil, fmt.Errorf("failed to select pool, the last filter field: %s, parameters %v",
key, parameters)
value, exists := parameters[key]
if exists {
filterPools = filter(value, filterPools)
if len(filterPools) == 0 {
return nil, fmt.Errorf("failed to select pool, the last filter field: %s, parameters %v",
key, parameters)
}
}
}

Expand Down

0 comments on commit 605caf2

Please sign in to comment.