Skip to content

Commit 6eb05ae

Browse files
committed
Remove cpu core from op_host_capacity while delete a host or put host to maintenance
When a host is put into maintenance mode or its deleted from cloudstack then delete its entries from op_host_capacity table
1 parent 0f3f2a0 commit 6eb05ae

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,7 @@ public void processDiscoverEventBefore(Long dcid, Long podId, Long clusterId, UR
11811181
public void processPrepareMaintenaceEventAfter(Long hostId) {
11821182
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_MEMORY, null, null, null, hostId);
11831183
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_CPU, null, null, null, hostId);
1184+
_capacityDao.removeBy(Capacity.CAPACITY_TYPE_CPU_CORE, null, null, null, hostId);
11841185
}
11851186

11861187
@Override

server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
930930
}
931931

932932
// delete the op_host_capacity entry
933-
final Object[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY};
933+
final Object[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY, Capacity.CAPACITY_TYPE_CPU_CORE};
934934
final SearchCriteria<CapacityVO> hostCapacitySC = _capacityDao.createSearchCriteria();
935935
hostCapacitySC.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, hostId);
936936
hostCapacitySC.addAnd("capacityType", SearchCriteria.Op.IN, capacityTypes);

0 commit comments

Comments
 (0)