mirror of https://github.com/apache/cloudstack.git
remove the unused use.new.networking configuration
This commit is contained in:
parent
a9aa592df2
commit
345d2ab81f
|
|
@ -259,7 +259,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||
protected long _nodeId = -1;
|
||||
protected int _overProvisioningFactor = 1;
|
||||
protected float _cpuOverProvisioningFactor = 1;
|
||||
private boolean _useNewNetworking;
|
||||
|
||||
|
||||
protected Random _rand = new Random(System.currentTimeMillis());
|
||||
|
|
@ -347,8 +346,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||
_cpuOverProvisioningFactor = 1;
|
||||
}
|
||||
|
||||
_useNewNetworking = Boolean.parseBoolean(configs.get("use.new.networking"));
|
||||
|
||||
_connection = new NioServer("AgentManager", _port, workers + 10, this);
|
||||
|
||||
s_logger.info("Listening on " + _port + " with " + workers + " workers");
|
||||
|
|
@ -438,38 +435,24 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||
public Host findHost(final Host.Type type, final DataCenterVO dc, final HostPodVO pod, final StoragePoolVO sp,
|
||||
final ServiceOfferingVO offering, final VMTemplateVO template, VMInstanceVO vm,
|
||||
Host currentHost, final Set<Host> avoid) {
|
||||
if (!_useNewNetworking) {
|
||||
VirtualMachineProfile<VMInstanceVO> vmc = new VirtualMachineProfileImpl<VMInstanceVO>(vm.getType());
|
||||
Enumeration<HostAllocator> en = _hostAllocators.enumeration();
|
||||
while (en.hasMoreElements()) {
|
||||
final HostAllocator allocator = en.nextElement();
|
||||
final Host host = allocator.allocateTo(vmc, offering, type, dc, pod, sp.getClusterId(), template, avoid);
|
||||
if (host == null) {
|
||||
continue;
|
||||
} else {
|
||||
return host;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm, template, offering, null, null, null);
|
||||
DeployDestination dest = null;
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), pod.getId(), sp.getClusterId(), null);
|
||||
ExcludeList avoids = new ExcludeList();
|
||||
for (Host h : avoid) {
|
||||
avoids.addHost(h.getId());
|
||||
}
|
||||
|
||||
for (DeploymentPlanner planner : _planners) {
|
||||
try {
|
||||
dest = planner.plan(vmProfile, plan, avoids);
|
||||
if (dest != null) {
|
||||
return dest.getHost();
|
||||
}
|
||||
} catch (InsufficientServerCapacityException e) {
|
||||
|
||||
VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm, template, offering, null, null, null);
|
||||
DeployDestination dest = null;
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), pod.getId(), sp.getClusterId(), null);
|
||||
ExcludeList avoids = new ExcludeList();
|
||||
for (Host h : avoid) {
|
||||
avoids.addHost(h.getId());
|
||||
}
|
||||
|
||||
for (DeploymentPlanner planner : _planners) {
|
||||
try {
|
||||
dest = planner.plan(vmProfile, plan, avoids);
|
||||
if (dest != null) {
|
||||
return dest.getHost();
|
||||
}
|
||||
} catch (InsufficientServerCapacityException e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
s_logger.warn("findHost() could not find a non-null host.");
|
||||
|
|
@ -2362,7 +2345,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||
List<CapacityVO> capacities = _capacityDao.search(capacitySC, null);
|
||||
|
||||
// remove old entries, we'll recalculate them anyway
|
||||
if (!_useNewNetworking || startup instanceof StartupStorageCommand) {
|
||||
if (startup instanceof StartupStorageCommand) {
|
||||
if ((capacities != null) && !capacities.isEmpty()) {
|
||||
for (CapacityVO capacity : capacities) {
|
||||
_capacityDao.remove(capacity.getId());
|
||||
|
|
@ -2382,68 +2365,59 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||
_capacityDao.persist(capacity);
|
||||
}
|
||||
} else if (startup instanceof StartupRoutingCommand) {
|
||||
if (!_useNewNetworking) {
|
||||
SearchCriteria<CapacityVO> capacityCPU = _capacityDao.createSearchCriteria();
|
||||
capacityCPU.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, server.getId());
|
||||
capacityCPU.addAnd("dataCenterId", SearchCriteria.Op.EQ, server.getDataCenterId());
|
||||
capacityCPU.addAnd("podId", SearchCriteria.Op.EQ, server.getPodId());
|
||||
capacityCPU.addAnd("capacityType", SearchCriteria.Op.EQ, CapacityVO.CAPACITY_TYPE_CPU);
|
||||
List<CapacityVO> capacityVOCpus = _capacityDao.search(capacitySC, null);
|
||||
|
||||
if (capacityVOCpus != null && !capacityVOCpus.isEmpty()) {
|
||||
CapacityVO CapacityVOCpu = capacityVOCpus.get(0);
|
||||
long newTotalCpu = (long)(server.getCpus().longValue() * server.getSpeed().longValue()*_cpuOverProvisioningFactor);
|
||||
if ((CapacityVOCpu.getTotalCapacity() <= newTotalCpu) || ((CapacityVOCpu.getUsedCapacity() + CapacityVOCpu.getReservedCapacity()) <= newTotalCpu)) {
|
||||
CapacityVOCpu.setTotalCapacity(newTotalCpu);
|
||||
} else if ((CapacityVOCpu.getUsedCapacity() + CapacityVOCpu.getReservedCapacity() > newTotalCpu) && (CapacityVOCpu.getUsedCapacity() < newTotalCpu)) {
|
||||
CapacityVOCpu.setReservedCapacity(0);
|
||||
CapacityVOCpu.setTotalCapacity(newTotalCpu);
|
||||
} else {
|
||||
s_logger.debug("What? new cpu is :" + newTotalCpu + ", old one is " + CapacityVOCpu.getUsedCapacity() + "," + CapacityVOCpu.getReservedCapacity() + "," +
|
||||
CapacityVOCpu.getTotalCapacity());
|
||||
}
|
||||
_capacityDao.update(CapacityVOCpu.getId(), CapacityVOCpu);
|
||||
} else {
|
||||
CapacityVO capacity = new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), 0L, (long)(server.getCpus().longValue()
|
||||
* server.getSpeed().longValue()*_cpuOverProvisioningFactor), CapacityVO.CAPACITY_TYPE_CPU);
|
||||
_capacityDao.persist(capacity);
|
||||
}
|
||||
|
||||
capacity = new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), 0L,
|
||||
SearchCriteria<CapacityVO> capacityMem = _capacityDao.createSearchCriteria();
|
||||
capacityMem.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, server.getId());
|
||||
capacityMem.addAnd("dataCenterId", SearchCriteria.Op.EQ, server.getDataCenterId());
|
||||
capacityMem.addAnd("podId", SearchCriteria.Op.EQ, server.getPodId());
|
||||
capacityMem.addAnd("capacityType", SearchCriteria.Op.EQ, CapacityVO.CAPACITY_TYPE_MEMORY);
|
||||
List<CapacityVO> capacityVOMems = _capacityDao.search(capacityMem, null);
|
||||
|
||||
if (capacityVOMems != null && !capacityVOMems.isEmpty()) {
|
||||
CapacityVO CapacityVOMem = capacityVOMems.get(0);
|
||||
long newTotalMem = server.getTotalMemory();
|
||||
if (CapacityVOMem.getTotalCapacity() <= newTotalMem || (CapacityVOMem.getUsedCapacity() + CapacityVOMem.getReservedCapacity() <= newTotalMem)) {
|
||||
CapacityVOMem.setTotalCapacity(newTotalMem);
|
||||
} else if (CapacityVOMem.getUsedCapacity() + CapacityVOMem.getReservedCapacity() > newTotalMem && CapacityVOMem.getUsedCapacity() < newTotalMem) {
|
||||
CapacityVOMem.setReservedCapacity(0);
|
||||
CapacityVOMem.setTotalCapacity(newTotalMem);
|
||||
} else {
|
||||
s_logger.debug("What? new cpu is :" + newTotalMem + ", old one is " + CapacityVOMem.getUsedCapacity() + "," + CapacityVOMem.getReservedCapacity() + "," +
|
||||
CapacityVOMem.getTotalCapacity());
|
||||
}
|
||||
_capacityDao.update(CapacityVOMem.getId(), CapacityVOMem);
|
||||
} else {
|
||||
CapacityVO capacity = new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), 0L,
|
||||
server.getTotalMemory(), CapacityVO.CAPACITY_TYPE_MEMORY);
|
||||
_capacityDao.persist(capacity);
|
||||
} else {
|
||||
SearchCriteria<CapacityVO> capacityCPU = _capacityDao.createSearchCriteria();
|
||||
capacityCPU.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, server.getId());
|
||||
capacityCPU.addAnd("dataCenterId", SearchCriteria.Op.EQ, server.getDataCenterId());
|
||||
capacityCPU.addAnd("podId", SearchCriteria.Op.EQ, server.getPodId());
|
||||
capacityCPU.addAnd("capacityType", SearchCriteria.Op.EQ, CapacityVO.CAPACITY_TYPE_CPU);
|
||||
List<CapacityVO> capacityVOCpus = _capacityDao.search(capacitySC, null);
|
||||
|
||||
if (capacityVOCpus != null && !capacityVOCpus.isEmpty()) {
|
||||
CapacityVO CapacityVOCpu = capacityVOCpus.get(0);
|
||||
long newTotalCpu = (long)(server.getCpus().longValue() * server.getSpeed().longValue()*_cpuOverProvisioningFactor);
|
||||
if ((CapacityVOCpu.getTotalCapacity() <= newTotalCpu) || ((CapacityVOCpu.getUsedCapacity() + CapacityVOCpu.getReservedCapacity()) <= newTotalCpu)) {
|
||||
CapacityVOCpu.setTotalCapacity(newTotalCpu);
|
||||
} else if ((CapacityVOCpu.getUsedCapacity() + CapacityVOCpu.getReservedCapacity() > newTotalCpu) && (CapacityVOCpu.getUsedCapacity() < newTotalCpu)) {
|
||||
CapacityVOCpu.setReservedCapacity(0);
|
||||
CapacityVOCpu.setTotalCapacity(newTotalCpu);
|
||||
} else {
|
||||
s_logger.debug("What? new cpu is :" + newTotalCpu + ", old one is " + CapacityVOCpu.getUsedCapacity() + "," + CapacityVOCpu.getReservedCapacity() + "," +
|
||||
CapacityVOCpu.getTotalCapacity());
|
||||
}
|
||||
_capacityDao.update(CapacityVOCpu.getId(), CapacityVOCpu);
|
||||
} else {
|
||||
CapacityVO capacity = new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), 0L, (long)(server.getCpus().longValue()
|
||||
* server.getSpeed().longValue()*_cpuOverProvisioningFactor), CapacityVO.CAPACITY_TYPE_CPU);
|
||||
_capacityDao.persist(capacity);
|
||||
}
|
||||
|
||||
SearchCriteria<CapacityVO> capacityMem = _capacityDao.createSearchCriteria();
|
||||
capacityMem.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, server.getId());
|
||||
capacityMem.addAnd("dataCenterId", SearchCriteria.Op.EQ, server.getDataCenterId());
|
||||
capacityMem.addAnd("podId", SearchCriteria.Op.EQ, server.getPodId());
|
||||
capacityMem.addAnd("capacityType", SearchCriteria.Op.EQ, CapacityVO.CAPACITY_TYPE_MEMORY);
|
||||
List<CapacityVO> capacityVOMems = _capacityDao.search(capacityMem, null);
|
||||
|
||||
if (capacityVOMems != null && !capacityVOMems.isEmpty()) {
|
||||
CapacityVO CapacityVOMem = capacityVOMems.get(0);
|
||||
long newTotalMem = server.getTotalMemory();
|
||||
if (CapacityVOMem.getTotalCapacity() <= newTotalMem || (CapacityVOMem.getUsedCapacity() + CapacityVOMem.getReservedCapacity() <= newTotalMem)) {
|
||||
CapacityVOMem.setTotalCapacity(newTotalMem);
|
||||
} else if (CapacityVOMem.getUsedCapacity() + CapacityVOMem.getReservedCapacity() > newTotalMem && CapacityVOMem.getUsedCapacity() < newTotalMem) {
|
||||
CapacityVOMem.setReservedCapacity(0);
|
||||
CapacityVOMem.setTotalCapacity(newTotalMem);
|
||||
} else {
|
||||
s_logger.debug("What? new cpu is :" + newTotalMem + ", old one is " + CapacityVOMem.getUsedCapacity() + "," + CapacityVOMem.getReservedCapacity() + "," +
|
||||
CapacityVOMem.getTotalCapacity());
|
||||
}
|
||||
_capacityDao.update(CapacityVOMem.getId(), CapacityVOMem);
|
||||
} else {
|
||||
CapacityVO capacity = new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), 0L,
|
||||
server.getTotalMemory(), CapacityVO.CAPACITY_TYPE_MEMORY);
|
||||
_capacityDao.persist(capacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// protected void upgradeAgent(final Link link, final byte[] request, final String reason) {
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ public class AlertManagerImpl implements AlertManager {
|
|||
private double _storageCapacityThreshold = 0.75;
|
||||
private double _storageAllocCapacityThreshold = 0.75;
|
||||
private double _publicIPCapacityThreshold = 0.75;
|
||||
private double _privateIPCapacityThreshold = 0.75;
|
||||
private boolean _useNewNetworking;
|
||||
private double _privateIPCapacityThreshold = 0.75;
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
|
|
@ -186,8 +185,6 @@ public class AlertManagerImpl implements AlertManager {
|
|||
_cpuOverProvisioningFactor = 1;
|
||||
}
|
||||
}
|
||||
|
||||
_useNewNetworking = Boolean.parseBoolean(configs.get("use.new.networking"));
|
||||
|
||||
_timer = new Timer("CapacityChecker");
|
||||
|
||||
|
|
@ -303,12 +300,8 @@ public class AlertManagerImpl implements AlertManager {
|
|||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
txn.start();
|
||||
// delete the old records
|
||||
if (_useNewNetworking) {
|
||||
_capacityDao.clearNonStorageCapacities2();
|
||||
} else {
|
||||
_capacityDao.clearNonStorageCapacities();
|
||||
}
|
||||
|
||||
_capacityDao.clearNonStorageCapacities2();
|
||||
|
||||
for (CapacityVO newCapacity : newCapacities) {
|
||||
s_logger.trace("Executing capacity update");
|
||||
|
|
|
|||
Loading…
Reference in New Issue