Remove cpu core from op_host_capacity when host is deleted (#4367)

When a host is put into maintenance mode or its deleted from
cloudstack then delete its entries from op_host_capacity table
This commit is contained in:
Rakesh 2020-10-28 09:41:14 +01:00 committed by GitHub
parent ff8a84ee77
commit b9f15fd159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -1179,6 +1179,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
public void processPrepareMaintenaceEventAfter(Long hostId) {
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_MEMORY, null, null, null, hostId);
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_CPU, null, null, null, hostId);
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_CPU_CORE, null, null, null, hostId);
}
@Override

View File

@ -929,7 +929,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
}
// delete the op_host_capacity entry
final Object[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY};
final Object[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY, Capacity.CAPACITY_TYPE_CPU_CORE};
final SearchCriteria<CapacityVO> hostCapacitySC = _capacityDao.createSearchCriteria();
hostCapacitySC.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, hostId);
hostCapacitySC.addAnd("capacityType", SearchCriteria.Op.IN, capacityTypes);