harikrishna-patnala commented on code in PR #8362:
URL: https://github.com/apache/cloudstack/pull/8362#discussion_r1489212377


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -2595,11 +2591,12 @@ private void updateVmStateForFailedVmCreation(Long 
vmId, Long hostId) {
                 String msg = "Failed to deploy Vm with Id: " + vmId + ", on 
Host with Id: " + hostId;
                 _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_USERVM, 
vm.getDataCenterId(), vm.getPodIdToDeployIn(), msg, msg);
 
-                // Get serviceOffering for Virtual Machine
+                // Get serviceOffering and template for Virtual Machine
                 ServiceOfferingVO offering = 
serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
+                VMTemplateVO tempalte = 
_templateDao.findByIdIncludingRemoved(vm.getTemplateId());

Review Comment:
   tempalte -> template 
   rename this please



##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -2414,25 +2415,24 @@ public CapacityVO getSecondaryStorageUsedStats(Long 
hostId, Long zoneId) {
         return capacity;
     }
 
-    @Override
-    public CapacityVO getStoragePoolUsedStats(Long poolId, Long clusterId, 
Long podId, Long zoneId) {
+    private CapacityVO getStoragePoolUsedStatsInternal(Long zoneId, Long 
podId, Long clusterId, List<Long> poolIds, Long poolId) {
         SearchCriteria<StoragePoolVO> sc = 
_storagePoolDao.createSearchCriteria();
-        List<StoragePoolVO> pools = new ArrayList<StoragePoolVO>();
+        List<StoragePoolVO> pools = new ArrayList<>();
 
         if (zoneId != null) {
             sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
         }
-
         if (podId != null) {
             sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
         }
-
         if (clusterId != null) {
             sc.addAnd("clusterId", SearchCriteria.Op.EQ, clusterId);
         }
-
+        if (CollectionUtils.isNotEmpty(poolIds)) {
+            sc.addAnd("id", SearchCriteria.Op.IN, poolIds.toArray());
+        }
         if (poolId != null) {
-            sc.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, poolId);
+            sc.addAnd("id", SearchCriteria.Op.EQ, poolId);

Review Comment:
   is this change related to this PR ?



##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -8487,10 +8536,15 @@ public Boolean getDestroyRootVolumeOnVmDestruction(Long 
domainId){
         return DestroyRootVolumeOnVmDestruction.valueIn(domainId);
     }
 
-    private void setVncPasswordForKvmIfAvailable(Map<String, String> 
customParameters, UserVmVO vm){
+    private void setVncPasswordForKvmIfAvailable(Map<String, String> 
customParameters, UserVmVO vm) {
         if (customParameters.containsKey(VmDetailConstants.KVM_VNC_PASSWORD)
                 && 
StringUtils.isNotEmpty(customParameters.get(VmDetailConstants.KVM_VNC_PASSWORD)))
 {
             
vm.setVncPassword(customParameters.get(VmDetailConstants.KVM_VNC_PASSWORD));
         }
     }
+
+    @Override
+    public Map<Long, Boolean> getDiskOfferingSuitabilityForVm(long vmId, 
List<Long> diskOfferingIds) {
+        return _itMgr.getDiskOfferingSuitabilityForVm(vmId, diskOfferingIds);

Review Comment:
   why did we need this in both uservmmanager and virtualmachinemanager ? We 
can keep it in one place right!



##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -2278,11 +2273,12 @@ public UserVm recoverVirtualMachine(RecoverVMCmd cmd) 
throws ResourceAllocationE
 
                 // Get serviceOffering for Virtual Machine
                 ServiceOfferingVO serviceOffering = 
serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
+                VMTemplateVO tempalte = 
_templateDao.findByIdIncludingRemoved(vm.getTemplateId());

Review Comment:
   tempalte -> template 
   rename this please



##########
server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java:
##########
@@ -1152,11 +1459,365 @@ public void changeResourceCount(long accountId, 
ResourceType type, Boolean displ
     }
 
     @Override
-    public ResourceReservation getReservation(final Account account, final 
Boolean displayResource, final Resource.ResourceType type, final Long delta) 
throws ResourceAllocationException {
-        if (! Boolean.FALSE.equals(displayResource)) {
-            return new CheckedReservation(account, type, delta, 
reservationDao, resourceLimitService);
+    public List<String> getResourceLimitHostTags() {
+        if 
(StringUtils.isEmpty(ResourceLimitService.ResourceLimitHostTags.value())) {
+            return new ArrayList<>();
+        }
+        return 
Arrays.asList(ResourceLimitService.ResourceLimitHostTags.value().split(","));

Review Comment:
   can we use trim() here something like 
   
              List<String> ResourceLimitHostTags = 
Stream.of(ResourceLimitService.ResourceLimitHostTags.value().split(","))
                       .map(item -> (item).trim())
                       .collect(Collectors.toList());



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to