mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
More logging changes for
Bug 7845 Productize DeploymentPlanner Bug 8317 Add better resource allocation failure messages
This commit is contained in:
parent
889827b63a
commit
6a67bb1edb
@ -206,7 +206,15 @@ public class CapacityManagerImpl implements CapacityManager , StateListener<Stat
|
||||
|
||||
boolean success = false;
|
||||
if (fromLastHost) {
|
||||
/*alloc from reserved*/
|
||||
/*alloc from reserved*/
|
||||
long freeCpu = reservedCpu;
|
||||
long freeMem = reservedMem;
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("We need to allocate to the last host again, so trying to allocate from reserved capacity");
|
||||
s_logger.debug("Free CPU: "+freeCpu + " , Requested CPU: "+cpu);
|
||||
s_logger.debug("Free RAM: "+freeMem + " , Requested RAM: "+ram);
|
||||
}
|
||||
if (reservedCpu >= cpu && reservedMem >= ram) {
|
||||
capacityCpu.setReservedCapacity(reservedCpu - cpu);
|
||||
capacityMem.setReservedCapacity(reservedMem - ram);
|
||||
@ -218,6 +226,13 @@ public class CapacityManagerImpl implements CapacityManager , StateListener<Stat
|
||||
}
|
||||
} else {
|
||||
/*alloc from free resource*/
|
||||
long freeCpu = totalCpu - (reservedCpu + usedCpu);
|
||||
long freeMem = totalMem - (reservedMem + usedMem);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Free CPU: "+freeCpu + " , Requested CPU: "+cpu);
|
||||
s_logger.debug("Free RAM: "+freeMem + " , Requested RAM: "+ram);
|
||||
}
|
||||
if ((reservedCpu + usedCpu + cpu <= totalCpu) && (reservedMem + usedMem + ram <= totalMem)) {
|
||||
capacityCpu.setUsedCapacity(usedCpu + cpu);
|
||||
capacityMem.setUsedCapacity(usedMem + ram);
|
||||
@ -226,12 +241,12 @@ public class CapacityManagerImpl implements CapacityManager , StateListener<Stat
|
||||
}
|
||||
|
||||
if (success) {
|
||||
s_logger.debug("alloc cpu from host: " + hostId + ", old used: " + usedCpu + ", old reserved: " +
|
||||
s_logger.debug("Success in alloc cpu from host: " + hostId + ", old used: " + usedCpu + ", old reserved: " +
|
||||
reservedCpu + ", old total: " + totalCpu +
|
||||
"; new used:" + capacityCpu.getUsedCapacity() + ", reserved:" + capacityCpu.getReservedCapacity() + ", total: " + capacityCpu.getTotalCapacity() +
|
||||
"; requested cpu:" + cpu + ",alloc_from_last:" + fromLastHost);
|
||||
|
||||
s_logger.debug("alloc mem from host: " + hostId + ", old used: " + usedMem + ", old reserved: " +
|
||||
s_logger.debug("Success in alloc mem from host: " + hostId + ", old used: " + usedMem + ", old reserved: " +
|
||||
reservedMem + ", old total: " + totalMem + "; new used: " + capacityMem.getUsedCapacity() + ", reserved: " +
|
||||
capacityMem.getReservedCapacity() + ", total: " + capacityMem.getTotalCapacity() + "; requested mem: " + ram + ",alloc_from_last:" + fromLastHost);
|
||||
|
||||
@ -273,14 +288,18 @@ public class CapacityManagerImpl implements CapacityManager , StateListener<Stat
|
||||
long reservedMem = capacityMem.getReservedCapacity();
|
||||
long totalCpu = capacityCpu.getTotalCapacity();
|
||||
long totalMem = capacityMem.getTotalCapacity();
|
||||
long freeCpu = totalCpu - (reservedCpu + usedCpu);
|
||||
long freeMem = totalMem - (reservedMem + usedMem);
|
||||
|
||||
|
||||
|
||||
String failureReason = "";
|
||||
if (checkFromReservedCapacity) {
|
||||
long freeCpu = reservedCpu;
|
||||
long freeMem = reservedMem;
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Checking from reserved capacity of the host, looks like allocating to last host");
|
||||
}
|
||||
s_logger.debug("We need to allocate to the last host again, so checking if there is enough reserved capacity");
|
||||
s_logger.debug("Free CPU: "+freeCpu + " , Requested CPU: "+cpu);
|
||||
s_logger.debug("Free RAM: "+freeMem + " , Requested RAM: "+ram);
|
||||
}
|
||||
/*alloc from reserved*/
|
||||
if (reservedCpu >= cpu){
|
||||
if(reservedMem >= ram) {
|
||||
@ -292,6 +311,13 @@ public class CapacityManagerImpl implements CapacityManager , StateListener<Stat
|
||||
failureReason = "Host does not have enough reserved CPU available";
|
||||
}
|
||||
} else {
|
||||
long freeCpu = totalCpu - (reservedCpu + usedCpu);
|
||||
long freeMem = totalMem - (reservedMem + usedMem);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Free CPU: "+freeCpu + " , Requested CPU: "+cpu);
|
||||
s_logger.debug("Free RAM: "+freeMem + " , Requested RAM: "+ram);
|
||||
}
|
||||
/*alloc from free resource*/
|
||||
if ((reservedCpu + usedCpu + cpu <= totalCpu)) {
|
||||
if((reservedMem + usedMem + ram <= totalMem)){
|
||||
@ -324,11 +350,6 @@ public class CapacityManagerImpl implements CapacityManager , StateListener<Stat
|
||||
s_logger.debug("STATS: Failed to alloc resource from host: " + hostId + " reservedCpu: " + reservedCpu + ", used cpu: " + usedCpu + ", requested cpu: " + cpu +
|
||||
", total cpu: " + totalCpu +
|
||||
", reservedMem: " + reservedMem + ", used Mem: " + usedMem + ", requested mem: " + ram + ", total Mem:" + totalMem);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Free CPU: "+freeCpu + " , Requested CPU: "+cpu);
|
||||
s_logger.debug("Free RAM: "+freeMem + " , Requested RAM: "+ram);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
||||
@ -166,7 +166,7 @@ public enum Config {
|
||||
ControlCidr("Advanced", ManagementServer.class, String.class, "control.cidr", "169.254.0.0/16", "Changes the cidr for the control network traffic. Defaults to using link local. Must be unique within pods", null),
|
||||
ControlGateway("Advanced", ManagementServer.class, String.class, "control.gateway", "169.254.0.1", "gateway for the control network traffic", null),
|
||||
UseUserConcentratedPodAllocation("Advanced", ManagementServer.class, Boolean.class, "use.user.concentrated.pod.allocation", "true", "If true, deployment planner applies the user concentration heuristic during VM resource allocation", "true,false"),
|
||||
HostCapacityTypeToOrderClusters("Advanced", ManagementServer.class, String.class, "host.capacityType.to.order.clusters", "CPU", "The host capacity type is used by deployment planner to order clusters during VM resource allocation", "CPU,RAM"),
|
||||
HostCapacityTypeToOrderClusters("Advanced", ManagementServer.class, String.class, "host.capacityType.to.order.clusters", "CPU", "The host capacity type (CPU or RAM) is used by deployment planner to order clusters during VM resource allocation", "CPU,RAM"),
|
||||
|
||||
// XenServer
|
||||
VmAllocationAlgorithm("Advanced", ManagementServer.class, String.class, "vm.allocation.algorithm", "random", "If 'random', hosts within a pod will be randomly considered for VM/volume allocation. If 'firstfit', they will be considered on a first-fit basis.", null),
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package com.cloud.storage.allocator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.ejb.Local;
|
||||
@ -62,7 +63,7 @@ public class FirstFitStoragePoolAllocator extends AbstractStoragePoolAllocator {
|
||||
long clusterId = plan.getClusterId();
|
||||
|
||||
if(dskCh.getTags() != null && dskCh.getTags().length != 0){
|
||||
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having tags:" + dskCh.getTags());
|
||||
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having tags:" + Arrays.toString(dskCh.getTags()));
|
||||
}else{
|
||||
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user