lucas-a-martins commented on code in PR #7214: URL: https://github.com/apache/cloudstack/pull/7214#discussion_r1467928635
########## server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java: ########## @@ -299,107 +302,39 @@ protected void avoidOtherClustersForDeploymentIfMigrationDisabled(VirtualMachine @Override public DeployDestination planDeployment(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids, DeploymentPlanner planner) throws InsufficientServerCapacityException, AffinityConflictException { + s_logger.debug(logDeploymentWithoutException(vmProfile.getVirtualMachine(), plan, avoids, planner)); ServiceOffering offering = vmProfile.getServiceOffering(); - int cpu_requested = offering.getCpu() * offering.getSpeed(); - long ram_requested = offering.getRamSize() * 1024L * 1024L; + int cpuRequested = offering.getCpu() * offering.getSpeed(); + long ramRequested = offering.getRamSize() * 1024L * 1024L; VirtualMachine vm = vmProfile.getVirtualMachine(); DataCenter dc = _dcDao.findById(vm.getDataCenterId()); boolean volumesRequireEncryption = anyVolumeRequiresEncryption(_volsDao.findByInstance(vm.getId())); if (vm.getType() == VirtualMachine.Type.User || vm.getType() == VirtualMachine.Type.DomainRouter) { + s_logger.debug(String.format("Checking non dedicated resources to deploy VM [%s].", + ReflectionToStringBuilderUtils.reflectOnlySelectedFields(vm, "uuid", "type", "instanceName"))); checkForNonDedicatedResources(vmProfile, dc, avoids); } - if (s_logger.isDebugEnabled()) { - s_logger.debug("DeploymentPlanner allocation algorithm: " + planner); - - s_logger.debug("Trying to allocate a host and storage pools from dc:" + plan.getDataCenterId() + ", pod:" + plan.getPodId() + ",cluster:" + - plan.getClusterId() + ", requested cpu: " + cpu_requested + ", requested ram: " + toHumanReadableSize(ram_requested)); - s_logger.debug("Is ROOT volume READY (pool already allocated)?: " + (plan.getPoolId() != null ? "Yes" : "No")); + if (s_logger.isDebugEnabled()) { + String datacenter = ReflectionToStringBuilderUtils.reflectOnlySelectedFields(dc, "uuid", "name"); + String podVO = ReflectionToStringBuilderUtils.reflectOnlySelectedFields(_podDao.findById(plan.getPodId()), "uuid", "name"); + String clusterVO = ReflectionToStringBuilderUtils.reflectOnlySelectedFields(_clusterDao.findById(plan.getClusterId()), "uuid", "name"); + String vmDetails = ReflectionToStringBuilderUtils.reflectOnlySelectedFields(vm, "uuid", "type", "instanceName"); + s_logger.debug(String.format("Trying to allocate a host and storage pools from datacenter [%s], pod [%s], cluster [%s], to deploy VM [%s] " + + "with requested CPU [%s] and requested RAM [%s].", datacenter, podVO, clusterVO, vmDetails, cpuRequested, toHumanReadableSize(ramRequested))); } + String isRootVolumeReadyMsg = plan.getPoolId() != null ? "is ready" : "is not ready"; + s_logger.debug(String.format("ROOT volume %s to deploy VM [%s].", vm.getUuid(), isRootVolumeReadyMsg)); Review Comment: ```suggestion s_logger.debug(String.format("ROOT volume %s to deploy VM [%s].", isRootVolumeReadyMsg, vm.getUuid())); ``` Aren't the order of these strings swapped? I imagine your idea in this message is something like `ROOT volume is ready/is not ready to deploy VM [VM's UUID]`, right? Maybe you should add the volume's uuid in this log too, imo this could be a really useful information. -- 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: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org