Internal LB: applyLoadBalancerRules - put not null check for sourceIpAddressId (can be null when Schema is not Public)

This commit is contained in:
Alena Prokharchyk 2013-04-10 15:28:12 -07:00
parent 87e5f5b9a6
commit 20beb7a16c
2 changed files with 5 additions and 3 deletions

View File

@ -734,7 +734,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
@Override
public VirtualRouterProvider addElement(Long nspId, VirtualRouterProviderType providerType) {
if (!(providerType != VirtualRouterProviderType.VirtualRouter) || (providerType != VirtualRouterProviderType.VPCVirtualRouter)) {
if (!(providerType == VirtualRouterProviderType.VirtualRouter || providerType == VirtualRouterProviderType.VPCVirtualRouter)) {
throw new InvalidParameterValueException("Element " + this.getName() + " supports only providerTypes: " +
VirtualRouterProviderType.VirtualRouter.toString() + " and " + VirtualRouterProviderType.VPCVirtualRouter);
}

View File

@ -1621,8 +1621,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
}
// if the rule is the last one for the ip address assigned to
// VPC, unassign it from the network
IpAddress ip = _ipAddressDao.findById(lb.getSourceIpAddressId());
_vpcMgr.unassignIPFromVpcNetwork(ip.getId(), lb.getNetworkId());
if (lb.getSourceIpAddressId() != null) {
IpAddress ip = _ipAddressDao.findById(lb.getSourceIpAddressId());
_vpcMgr.unassignIPFromVpcNetwork(ip.getId(), lb.getNetworkId());
}
}
}