JoaoJandre commented on code in PR #9844:
URL: https://github.com/apache/cloudstack/pull/9844#discussion_r1842093570
##########
server/src/main/java/com/cloud/resource/RollingMaintenanceManagerImpl.java:
##########
@@ -666,11 +682,36 @@ private Pair<Boolean, String>
performCapacityChecksBeforeHostInMaintenance(Host
return new Pair<>(true, "OK");
}
+ protected Ternary<Integer, Integer, Integer>
getComputeResourcesCpuSpeedAndRamSize(VMInstanceVO runningVM) {
+ ServiceOfferingVO serviceOffering =
serviceOfferingDao.findById(runningVM.getServiceOfferingId());
+ Integer cpu = serviceOffering.getCpu();
+ Integer speed = serviceOffering.getSpeed();
+ Integer ramSize = serviceOffering.getRamSize();
+ if (serviceOffering.isDynamic()) {
+ List<UserVmDetailVO> vmDetails =
userVmDetailsDao.listDetails(runningVM.getId());
+ if (CollectionUtils.isNotEmpty(vmDetails)) {
+ for (UserVmDetailVO vmDetail : vmDetails) {
+ if (vmDetail.getName() != null && vmDetail.getValue() !=
null) {
+ if (cpu == null &&
VmDetailConstants.CPU_NUMBER.equals(vmDetail.getName())) {
+ cpu = Integer.valueOf(vmDetail.getValue());
+ } else if (speed == null &&
VmDetailConstants.CPU_SPEED.equals(vmDetail.getName())) {
+ speed = Integer.valueOf(vmDetail.getValue());
+ } else if (ramSize == null &&
VmDetailConstants.MEMORY.equals(vmDetail.getName())) {
+ ramSize = Integer.valueOf(vmDetail.getValue());
+ }
+ }
+ }
+ }
+ }
Review Comment:
Its a very simple change for readability, do we really need another PR for
it?
--
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]