CLOUDSTACK-5667: Shared Network - fails to launch router due to "

Multiple generic soure NAT IPs provided for network"

'getExistingSourceNatInNetwork' method was retruning source nat ip for
a particular account, resulting in multiple source nat ip's to be
assigned to a shared network on network implemen. Fix ensures that
account id is not considered for shared network implement.
This commit is contained in:
Murali Reddy 2013-12-31 11:02:54 +05:30
parent c1101eb695
commit 14241ce233
1 changed files with 8 additions and 2 deletions

View File

@ -1105,8 +1105,14 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
}
protected IPAddressVO getExistingSourceNatInNetwork(long ownerId, Long networkId) {
List<? extends IpAddress> addrs = _networkModel.listPublicIpsAssignedToGuestNtwk(ownerId, networkId, true);
List<? extends IpAddress> addrs;
Network guestNetwork = _networksDao.findById(networkId);
if (guestNetwork.getGuestType() == GuestType.Shared) {
// ignore the account id for the shared network
addrs = _networkModel.listPublicIpsAssignedToGuestNtwk(networkId, true);
} else {
addrs = _networkModel.listPublicIpsAssignedToGuestNtwk(ownerId, networkId, true);
}
IPAddressVO sourceNatIp = null;
if (addrs.isEmpty()) {