CLOUDSTACK-5062: Deleting Load Balancing Rule fails when generating

usage events are enabled

Signed-off-by: Daan Hoogland <daan@onecht.net>(cherry picked from commit 62a259ffa9)
Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
This commit is contained in:
David Grizzanti 2014-01-31 11:25:59 +01:00 committed by Animesh Chaturvedi
parent c0e70b51fc
commit 91ec548fc0
1 changed files with 7 additions and 1 deletions

View File

@ -1405,7 +1405,8 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (generateUsageEvent) {
// Generate usage event right after all rules were marked for revoke
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_LOAD_BALANCER_DELETE, lb.getAccountId(), 0, lb.getId(),
Network network = _networkModel.getNetwork(lb.getNetworkId());
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_LOAD_BALANCER_DELETE, lb.getAccountId(), network.getDataCenterId(), lb.getId(),
null, LoadBalancingRule.class.getName(), lb.getUuid());
}
@ -2052,6 +2053,11 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
List<String> serviceStates = new ArrayList<String>();
List<LoadBalancerVMMapVO> vmLoadBalancerMappings = null;
vmLoadBalancerMappings = _lb2VmMapDao.listByLoadBalancerId(loadBalancerId);
if(vmLoadBalancerMappings == null) {
String msg = "no VM Loadbalancer Mapping found";
s_logger.error(msg);
throw new CloudRuntimeException(msg);
}
Map<Long, String> vmServiceState = new HashMap<Long, String>(vmLoadBalancerMappings.size());
List<Long> appliedInstanceIdList = new ArrayList<Long>();