Skip to content

Commit 62a259f

Browse files
dgrizzantiDaanHoogland
authored andcommitted
CLOUDSTACK-5062: Deleting Load Balancing Rule fails when generating
usage events are enabled Signed-off-by: Daan Hoogland <daan@onecht.net>
1 parent f4db8df commit 62a259f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,8 @@ public List<LoadBalancerVMMapVO> doInTransaction(TransactionStatus status) {
14051405

14061406
if (generateUsageEvent) {
14071407
// Generate usage event right after all rules were marked for revoke
1408-
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_LOAD_BALANCER_DELETE, lb.getAccountId(), 0, lb.getId(),
1408+
Network network = _networkModel.getNetwork(lb.getNetworkId());
1409+
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_LOAD_BALANCER_DELETE, lb.getAccountId(), network.getDataCenterId(), lb.getId(),
14091410
null, LoadBalancingRule.class.getName(), lb.getUuid());
14101411
}
14111412

@@ -2052,6 +2053,11 @@ public Pair<List<? extends UserVm>, List<String>> listLoadBalancerInstances(List
20522053
List<String> serviceStates = new ArrayList<String>();
20532054
List<LoadBalancerVMMapVO> vmLoadBalancerMappings = null;
20542055
vmLoadBalancerMappings = _lb2VmMapDao.listByLoadBalancerId(loadBalancerId);
2056+
if(vmLoadBalancerMappings == null) {
2057+
String msg = "no VM Loadbalancer Mapping found";
2058+
s_logger.error(msg);
2059+
throw new CloudRuntimeException(msg);
2060+
}
20552061
Map<Long, String> vmServiceState = new HashMap<Long, String>(vmLoadBalancerMappings.size());
20562062
List<Long> appliedInstanceIdList = new ArrayList<Long>();
20572063

0 commit comments

Comments
 (0)