This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.14
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.14 by this push:
     new b9f15fd  Remove cpu core from op_host_capacity when host is deleted 
(#4367)
b9f15fd is described below

commit b9f15fd15999944b3f3befdb51d308a74e060e18
Author: Rakesh <[email protected]>
AuthorDate: Wed Oct 28 09:41:14 2020 +0100

    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
---
 server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java | 1 +
 server/src/main/java/com/cloud/resource/ResourceManagerImpl.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java 
b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java
index b3f3a62..5530e53 100644
--- a/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java
@@ -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
diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java 
b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
index c1c221b..6945d6f 100755
--- a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
@@ -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);

Reply via email to