mirror of https://github.com/apache/cloudstack.git
bug 10848: Removing the Host Capacity Checker thread which checks for skipcounting hours and also keeps host's CPU and Memory in sync. This work would be done by capacity checker thread now.
This commit is contained in:
parent
4c1a2f50bd
commit
cfebce78b0
|
|
@ -42,6 +42,7 @@ import javax.naming.ConfigurationException;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.alert.dao.AlertDao;
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.configuration.Config;
|
||||
|
|
@ -51,6 +52,7 @@ import com.cloud.dc.HostPodVO;
|
|||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.DataCenterIpAddressDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
|
|
@ -85,8 +87,8 @@ public class AlertManagerImpl implements AlertManager {
|
|||
private EmailAlert _emailAlert;
|
||||
@Inject private AlertDao _alertDao;
|
||||
@Inject private HostDao _hostDao;
|
||||
@Inject protected StorageManager _storageMgr;
|
||||
@Inject private ServiceOfferingDao _offeringsDao;
|
||||
@Inject protected StorageManager _storageMgr;
|
||||
@Inject protected CapacityManager _capacityMgr;
|
||||
@Inject private CapacityDao _capacityDao;
|
||||
@Inject private DataCenterDao _dcDao;
|
||||
@Inject private HostPodDao _podDao;
|
||||
|
|
@ -239,16 +241,12 @@ public class AlertManagerImpl implements AlertManager {
|
|||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("recalculating system capacity");
|
||||
}
|
||||
|
||||
// get all hosts..
|
||||
SearchCriteria<HostVO> sc = _hostDao.createSearchCriteria();
|
||||
sc.addAnd("status", SearchCriteria.Op.EQ, Status.Up.toString());
|
||||
|
||||
// prep the service offerings
|
||||
List<ServiceOfferingVO> offerings = _offeringsDao.listAllIncludingRemoved();
|
||||
Map<Long, ServiceOfferingVO> offeringsMap = new HashMap<Long, ServiceOfferingVO>();
|
||||
for (ServiceOfferingVO offering : offerings) {
|
||||
offeringsMap.put(offering.getId(), offering);
|
||||
|
||||
// Calculate CPU and RAM capacitites
|
||||
// get all hosts...even if they are not in 'UP' state
|
||||
List<HostVO> hosts = _hostDao.listByType(Host.Type.Routing);
|
||||
for (HostVO host : hosts) {
|
||||
_capacityMgr.updateCapacityForHost(host);
|
||||
}
|
||||
|
||||
// Calculate storage pool capacity
|
||||
|
|
@ -274,9 +272,9 @@ public class AlertManagerImpl implements AlertManager {
|
|||
//ideal way would be to remove out the vlan param, and filter only on dcId
|
||||
//implementing the same
|
||||
|
||||
s_logger.trace("Executing capacity update");
|
||||
s_logger.trace("Executing public ip capacity update");
|
||||
createOrUpdateIpCapacity(dcId, null, CapacityVO.CAPACITY_TYPE_PUBLIC_IP);
|
||||
s_logger.trace("Done with capacity update");
|
||||
s_logger.trace("Done with public ip capacity update");
|
||||
|
||||
}
|
||||
txn.commit();
|
||||
|
|
@ -288,9 +286,9 @@ public class AlertManagerImpl implements AlertManager {
|
|||
long podId = pod.getId();
|
||||
long dcId = pod.getDataCenterId();
|
||||
|
||||
s_logger.trace("Executing capacity update");
|
||||
s_logger.trace("Executing private ip capacity update");
|
||||
createOrUpdateIpCapacity(dcId, podId, CapacityVO.CAPACITY_TYPE_PRIVATE_IP);
|
||||
s_logger.trace("Done with capacity update");
|
||||
s_logger.trace("Done with private ip capacity update");
|
||||
|
||||
}
|
||||
txn.commit();
|
||||
|
|
|
|||
|
|
@ -91,8 +91,6 @@ public class CapacityManagerImpl implements CapacityManager, StateListener<State
|
|||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
_name = name;
|
||||
_hostCapacityCheckerDelay = NumbersUtil.parseInt(_configDao.getValue(Config.HostCapacityCheckerWait.key()), 3600);
|
||||
_hostCapacityCheckerInterval = NumbersUtil.parseInt(_configDao.getValue(Config.HostCapacityCheckerInterval.key()), 3600);
|
||||
_vmCapacityReleaseInterval = NumbersUtil.parseInt(_configDao.getValue(Config.CapacitySkipcountingHours.key()), 3600);
|
||||
_storageOverProvisioningFactor = NumbersUtil.parseFloat(_configDao.getValue(Config.StorageOverprovisioningFactor.key()), 1.0f);
|
||||
_cpuOverProvisioningFactor = NumbersUtil.parseFloat(_configDao.getValue(Config.CPUOverprovisioningFactor.key()), 1.0f);
|
||||
|
|
@ -110,7 +108,6 @@ public class CapacityManagerImpl implements CapacityManager, StateListener<State
|
|||
|
||||
@Override
|
||||
public boolean start() {
|
||||
_executor.scheduleWithFixedDelay(new HostCapacityCollector(), _hostCapacityCheckerDelay, _hostCapacityCheckerInterval, TimeUnit.SECONDS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -413,20 +410,6 @@ public class CapacityManagerImpl implements CapacityManager, StateListener<State
|
|||
return hasCapacity;
|
||||
|
||||
}
|
||||
|
||||
public class HostCapacityCollector implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
s_logger.debug("HostCapacityCollector is running...");
|
||||
// get all hosts...even if they are not in 'UP' state
|
||||
List<HostVO> hosts = _hostDao.listByType(Host.Type.Routing);
|
||||
for (HostVO host : hosts) {
|
||||
updateCapacityForHost(host);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCapacityForHost(HostVO host){
|
||||
|
|
|
|||
|
|
@ -190,9 +190,7 @@ public enum Config {
|
|||
DirectAttachNetworkExternalAPIURL("Advanced", ManagementServer.class, String.class, "direct.attach.network.externalIpAllocator.url", null, "Direct-attach VMs using external DHCP server (API url)", null),
|
||||
CheckPodCIDRs("Advanced", ManagementServer.class, String.class, "check.pod.cidrs", "true", "If true, different pods must belong to different CIDR subnets.", "true,false"),
|
||||
NetworkGcWait("Advanced", ManagementServer.class, Integer.class, "network.gc.wait", "600", "Time (in seconds) to wait before shutting down a network that's not in used", null),
|
||||
NetworkGcInterval("Advanced", ManagementServer.class, Integer.class, "network.gc.interval", "600", "Seconds to wait before checking for networks to shutdown", null),
|
||||
HostCapacityCheckerWait("Advanced", ManagementServer.class, Integer.class, "host.capacity.checker.wait", "3600", "Time (in seconds) to wait before starting host capacity background checker", null),
|
||||
HostCapacityCheckerInterval("Advanced", ManagementServer.class, Integer.class, "host.capacity.checker.interval", "3600", "Time (in seconds) to wait before recalculating host's capacity", null),
|
||||
NetworkGcInterval("Advanced", ManagementServer.class, Integer.class, "network.gc.interval", "600", "Seconds to wait before checking for networks to shutdown", null),
|
||||
CapacitySkipcountingHours("Advanced", ManagementServer.class, Integer.class, "capacity.skipcounting.hours", "3600", "Time (in seconds) to wait before release VM's cpu and memory when VM in stopped state", null),
|
||||
VmStatsInterval("Advanced", ManagementServer.class, Integer.class, "vm.stats.interval", "60000", "The interval (in milliseconds) when vm stats are retrieved from agents.", null),
|
||||
VmTransitionWaitInterval("Advanced", ManagementServer.class, Integer.class, "vm.tranisition.wait.interval", "3600", "Time (in seconds) to wait before taking over a VM in transition state", null),
|
||||
|
|
|
|||
Loading…
Reference in New Issue