CS-15083: fixed source nat ip assoc for the case when account owns more than 1 guest network, and 1+ public account specific ranges

This commit is contained in:
Alena Prokharchyk 2012-05-24 13:40:25 -07:00
parent 45311fefc1
commit f6efcd39a3
1 changed files with 5 additions and 1 deletions

View File

@ -513,7 +513,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
Long vlanId = null;
List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByAccount(ownerId);
if (maps != null && !maps.isEmpty()) {
vlanId = maps.get(0).getVlanDbId();
//check if the ips from this vlan are associated with this network
List<IPAddressVO> ips = _ipAddressDao.listByVlanId(maps.get(0).getVlanDbId());
if (ips != null && !ips.isEmpty() && ips.get(0).getAssociatedWithNetworkId() == network.getId()) {
vlanId = maps.get(0).getVlanDbId();
}
}
ip = fetchNewPublicIp(dcId, null, vlanId, owner, VlanType.VirtualNetwork, network.getId(), true, false, null, false);