Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/opensds/opensds into…
Browse files Browse the repository at this point in the history
… new-patch
  • Loading branch information
leonwanghui committed Apr 8, 2018
2 parents b180360 + 5667bed commit 5bb59bd
Show file tree
Hide file tree
Showing 6 changed files with 489 additions and 509 deletions.
20 changes: 13 additions & 7 deletions pkg/controller/selector/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,28 @@ func GetPoolCapabilityMap(pool *model.StoragePoolSpec) (map[string]interface{},
return nil, err
}

lastSimpleMap := make(map[string]interface{})
result := make(map[string]interface{})

for {
// There is no infinite loop here, so set the maximum number of loops to 10.
for i := 0; i < 10; i++ {
simpleMap, unSimpleMap := simplifyPoolCapabilityMap(temMap)

if 0 == len(unSimpleMap) {
for key, value := range lastSimpleMap {
simpleMap[key] = value
if 0 != len(result) {
for key, value := range simpleMap {
result[key] = value
}
} else {
result = simpleMap
}

return simpleMap, nil
if 0 == len(unSimpleMap) {
return result, nil
}

lastSimpleMap = simpleMap
temMap = unSimpleMap
}

return result, nil
}

// IsAvailablePool ...
Expand Down

0 comments on commit 5bb59bd

Please sign in to comment.