|
237 | 237 | import com.cloud.network.security.SecurityGroupVMMapVO; |
238 | 238 | import com.cloud.network.security.dao.SecurityGroupVMMapDao; |
239 | 239 | import com.cloud.offering.DiskOffering; |
| 240 | +import com.cloud.offering.ServiceOffering; |
240 | 241 | import com.cloud.org.Grouping; |
241 | 242 | import com.cloud.projects.Project; |
242 | 243 | import com.cloud.projects.Project.ListProjectResourcesCriteria; |
@@ -3142,6 +3143,8 @@ private Pair<List<DiskOfferingJoinVO>, Integer> searchForDiskOfferingsInternal(L |
3142 | 3143 | Long volumeId = cmd.getVolumeId(); |
3143 | 3144 | Long storagePoolId = cmd.getStoragePoolId(); |
3144 | 3145 | Boolean encrypt = cmd.getEncrypt(); |
| 3146 | + String storageType = cmd.getStorageType(); |
| 3147 | + |
3145 | 3148 | // Keeping this logic consistent with domain specific zones |
3146 | 3149 | // if a domainId is provided, we just return the disk offering |
3147 | 3150 | // associated with this domain |
@@ -3193,6 +3196,8 @@ private Pair<List<DiskOfferingJoinVO>, Integer> searchForDiskOfferingsInternal(L |
3193 | 3196 | sc.addAnd("encrypt", SearchCriteria.Op.EQ, encrypt); |
3194 | 3197 | } |
3195 | 3198 |
|
| 3199 | + useStorageType(sc, storageType); |
| 3200 | + |
3196 | 3201 | if (zoneId != null) { |
3197 | 3202 | SearchBuilder<DiskOfferingJoinVO> sb = _diskOfferingJoinDao.createSearchBuilder(); |
3198 | 3203 | sb.and("zoneId", sb.entity().getZoneId(), Op.FIND_IN_SET); |
@@ -3272,6 +3277,17 @@ private Pair<List<DiskOfferingJoinVO>, Integer> searchForDiskOfferingsInternal(L |
3272 | 3277 | return new Pair<>(result.first(), result.second()); |
3273 | 3278 | } |
3274 | 3279 |
|
| 3280 | + private void useStorageType(SearchCriteria<?> sc, String storageType) { |
| 3281 | + if (storageType != null) { |
| 3282 | + if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.local.toString())) { |
| 3283 | + sc.addAnd("useLocalStorage", Op.EQ, true); |
| 3284 | + |
| 3285 | + } else if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.shared.toString())) { |
| 3286 | + sc.addAnd("useLocalStorage", Op.EQ, false); |
| 3287 | + } |
| 3288 | + } |
| 3289 | + } |
| 3290 | + |
3275 | 3291 | private List<Long> findRelatedDomainIds(Domain domain, boolean isRecursive) { |
3276 | 3292 | List<Long> domainIds = _domainDao.getDomainParentIds(domain.getId()) |
3277 | 3293 | .stream().collect(Collectors.toList()); |
@@ -3321,6 +3337,7 @@ private Pair<List<ServiceOfferingJoinVO>, Integer> searchForServiceOfferingsInte |
3321 | 3337 | Integer memory = cmd.getMemory(); |
3322 | 3338 | Integer cpuSpeed = cmd.getCpuSpeed(); |
3323 | 3339 | Boolean encryptRoot = cmd.getEncryptRoot(); |
| 3340 | + String storageType = cmd.getStorageType(); |
3324 | 3341 |
|
3325 | 3342 | SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria(); |
3326 | 3343 | if (!accountMgr.isRootAdmin(caller.getId()) && isSystem) { |
@@ -3444,6 +3461,8 @@ private Pair<List<ServiceOfferingJoinVO>, Integer> searchForServiceOfferingsInte |
3444 | 3461 | sc.addAnd("vmType", SearchCriteria.Op.EQ, vmTypeStr); |
3445 | 3462 | } |
3446 | 3463 |
|
| 3464 | + useStorageType(sc, storageType); |
| 3465 | + |
3447 | 3466 | if (zoneId != null) { |
3448 | 3467 | SearchBuilder<ServiceOfferingJoinVO> sb = _srvOfferingJoinDao.createSearchBuilder(); |
3449 | 3468 | sb.and("zoneId", sb.entity().getZoneId(), Op.FIND_IN_SET); |
|
0 commit comments