|
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; |
@@ -3130,6 +3131,8 @@ private Pair<List<DiskOfferingJoinVO>, Integer> searchForDiskOfferingsInternal(L |
3130 | 3131 | Long volumeId = cmd.getVolumeId(); |
3131 | 3132 | Long storagePoolId = cmd.getStoragePoolId(); |
3132 | 3133 | Boolean encrypt = cmd.getEncrypt(); |
| 3134 | + String storageType = cmd.getStorageType(); |
| 3135 | + |
3133 | 3136 | // Keeping this logic consistent with domain specific zones |
3134 | 3137 | // if a domainId is provided, we just return the disk offering |
3135 | 3138 | // associated with this domain |
@@ -3181,6 +3184,8 @@ private Pair<List<DiskOfferingJoinVO>, Integer> searchForDiskOfferingsInternal(L |
3181 | 3184 | sc.addAnd("encrypt", SearchCriteria.Op.EQ, encrypt); |
3182 | 3185 | } |
3183 | 3186 |
|
| 3187 | + useStorageType(sc, storageType); |
| 3188 | + |
3184 | 3189 | if (zoneId != null) { |
3185 | 3190 | SearchBuilder<DiskOfferingJoinVO> sb = _diskOfferingJoinDao.createSearchBuilder(); |
3186 | 3191 | sb.and("zoneId", sb.entity().getZoneId(), Op.FIND_IN_SET); |
@@ -3260,6 +3265,17 @@ private Pair<List<DiskOfferingJoinVO>, Integer> searchForDiskOfferingsInternal(L |
3260 | 3265 | return new Pair<>(result.first(), result.second()); |
3261 | 3266 | } |
3262 | 3267 |
|
| 3268 | + private void useStorageType(SearchCriteria<?> sc, String storageType) { |
| 3269 | + if (storageType != null) { |
| 3270 | + if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.local.toString())) { |
| 3271 | + sc.addAnd("useLocalStorage", Op.EQ, true); |
| 3272 | + |
| 3273 | + } else if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.shared.toString())) { |
| 3274 | + sc.addAnd("useLocalStorage", Op.EQ, false); |
| 3275 | + } |
| 3276 | + } |
| 3277 | + } |
| 3278 | + |
3263 | 3279 | private List<Long> findRelatedDomainIds(Domain domain, boolean isRecursive) { |
3264 | 3280 | List<Long> domainIds = _domainDao.getDomainParentIds(domain.getId()) |
3265 | 3281 | .stream().collect(Collectors.toList()); |
@@ -3309,6 +3325,7 @@ private Pair<List<ServiceOfferingJoinVO>, Integer> searchForServiceOfferingsInte |
3309 | 3325 | Integer memory = cmd.getMemory(); |
3310 | 3326 | Integer cpuSpeed = cmd.getCpuSpeed(); |
3311 | 3327 | Boolean encryptRoot = cmd.getEncryptRoot(); |
| 3328 | + String storageType = cmd.getStorageType(); |
3312 | 3329 |
|
3313 | 3330 | SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria(); |
3314 | 3331 | if (!accountMgr.isRootAdmin(caller.getId()) && isSystem) { |
@@ -3432,6 +3449,8 @@ private Pair<List<ServiceOfferingJoinVO>, Integer> searchForServiceOfferingsInte |
3432 | 3449 | sc.addAnd("vmType", SearchCriteria.Op.EQ, vmTypeStr); |
3433 | 3450 | } |
3434 | 3451 |
|
| 3452 | + useStorageType(sc, storageType); |
| 3453 | + |
3435 | 3454 | if (zoneId != null) { |
3436 | 3455 | SearchBuilder<ServiceOfferingJoinVO> sb = _srvOfferingJoinDao.createSearchBuilder(); |
3437 | 3456 | sb.and("zoneId", sb.entity().getZoneId(), Op.FIND_IN_SET); |
|
0 commit comments