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 fc796632ed984f37fdf32e6aedf26d179a70b22f)
Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
David Grizzanti 2013-11-06 12:57:46 -05:00 committed by Daan Hoogland
parent 7d0472bdaa
commit ce4b718f4a

View File

@ -1348,8 +1348,9 @@ 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(), null, LoadBalancingRule.class.getName(),
lb.getUuid());
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());
}
return backupMaps;
@ -1970,6 +1971,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>();