From 0f1cd6009d7190535cb4e7c6ee96bbc564d3129e Mon Sep 17 00:00:00 2001 From: dahn Date: Fri, 4 Feb 2022 17:02:32 +0100 Subject: [PATCH] add logging to deployment planners (#5859) Co-authored-by: sureshanaparti <12028987+sureshanaparti@users.noreply.github.com> Co-authored-by: Daan Hoogland Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com> Co-authored-by: sureshanaparti <12028987+sureshanaparti@users.noreply.github.com> --- .../org/apache/cloudstack/api/BaseCmd.java | 2 +- .../cloud/entity/api/VMEntityManagerImpl.java | 2 +- .../affinity/ExplicitDedicationProcessor.java | 6 ++++++ .../deploy/ImplicitDedicationPlanner.java | 2 +- .../deploy/DeploymentPlanningManagerImpl.java | 19 ++++++++++++++++++- ui/public/locales/en.json | 2 +- ui/src/views/offering/AddComputeOffering.vue | 2 +- 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java index 6575f1e6062..475745d081a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java @@ -355,7 +355,7 @@ public abstract class BaseCmd { if (roleIsAllowed) { validFields.add(field); } else { - s_logger.debug("Ignoring paremeter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in"); + s_logger.debug("Ignoring parameter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in"); } } diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java index 02ffb37ba15..d9b7722f308 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java @@ -221,7 +221,7 @@ public class VMEntityManagerImpl implements VMEntityManager { // call retry it. return UUID.randomUUID().toString(); } else { - throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId(), + throw new InsufficientServerCapacityException("No destination found for a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile)); } } diff --git a/plugins/affinity-group-processors/explicit-dedication/src/main/java/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java b/plugins/affinity-group-processors/explicit-dedication/src/main/java/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java index 905890493d2..8070a7409b5 100644 --- a/plugins/affinity-group-processors/explicit-dedication/src/main/java/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java +++ b/plugins/affinity-group-processors/explicit-dedication/src/main/java/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java @@ -305,6 +305,9 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement for (HostPodVO pod : podList) { DedicatedResourceVO dPod = _dedicatedDao.findByPodId(pod.getId()); if (dPod != null && !dedicatedResources.contains(dPod)) { + if (s_logger.isDebugEnabled()) { + s_logger.debug(String.format("Avoiding POD %s [%s] because it is not dedicated.", pod.getName(), pod.getUuid())); + } avoidList.addPod(pod.getId()); } else { includeList.addPod(pod.getId()); @@ -343,6 +346,9 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement for (HostPodVO pod : pods) { if (podsInIncludeList != null && !podsInIncludeList.contains(pod.getId())) { + if (s_logger.isDebugEnabled()) { + s_logger.debug(String.format("Avoiding POD %s [%s], as it is not in include list.", pod.getName(), pod.getUuid())); + } avoidList.addPod(pod.getId()); } } diff --git a/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java index 45f16abd2af..2c5a72498bc 100644 --- a/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java +++ b/plugins/deployment-planners/implicit-dedication/src/main/java/com/cloud/deploy/ImplicitDedicationPlanner.java @@ -107,7 +107,7 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy } } - // Hosts running vms of other accounts created by ab implicit planner in strict mode should always be avoided. + // Hosts running vms of other accounts created by an implicit planner in strict mode should always be avoided. avoid.addHostList(hostRunningStrictImplicitVmsOfOtherAccounts); if (!hostRunningVmsOfAccount.isEmpty() && (hostsToAvoid == null || !hostsToAvoid.containsAll(hostRunningVmsOfAccount))) { diff --git a/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java index 5a42f6e321c..fd33bed50c3 100644 --- a/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -754,9 +754,17 @@ StateListener, Configurable { //Only when the type is instance VM and not explicitly dedicated. if (vm.getType() == VirtualMachine.Type.User && !isExplicit) { //add explicitly dedicated resources in avoidList - + if (s_logger.isDebugEnabled()) { + s_logger.debug("Adding pods to avoid lists for non-explicit VM deployment: " + allPodsInDc); + } avoids.addPodList(allPodsInDc); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Adding clusters to avoid lists for non-explicit VM deployment: " + allClustersInDc); + } avoids.addClusterList(allClustersInDc); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Adding hosts to avoid lists for non-explicit VM deployment: " + allHostsInDc); + } avoids.addHostList(allHostsInDc); } @@ -835,8 +843,17 @@ StateListener, Configurable { } //Add in avoid list or no addition if no dedication + if (s_logger.isDebugEnabled()) { + s_logger.debug("Adding pods to avoid lists: " + allPodsInDc); + } avoids.addPodList(allPodsInDc); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Adding clusters to avoid lists: " + allClustersInDc); + } avoids.addClusterList(allClustersInDc); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Adding hosts to avoid lists: " + allHostsInDc); + } avoids.addHostList(allHostsInDc); } } diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index 9c44d838495..60dbff4444b 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -1674,7 +1674,7 @@ "label.powerflex.gateway.username": "Gateway Username", "label.powerflex.storage.pool": "Storage Pool", "label.powerstate": "Power State", -"label.preferred": "Prefered", +"label.preferred": "Preferred", "label.presetup": "PreSetup", "label.prev": "Prev", "label.previous": "Previous", diff --git a/ui/src/views/offering/AddComputeOffering.vue b/ui/src/views/offering/AddComputeOffering.vue index 3aa52ac458d..bcc09c1e9d5 100644 --- a/ui/src/views/offering/AddComputeOffering.vue +++ b/ui/src/views/offering/AddComputeOffering.vue @@ -394,7 +394,7 @@ {{ $t('label.strict') }} - + {{ $t('label.preferred') }}