CLOUDSTACK-4013: [PortableIP] [MultiplePhysicalNetworks] Associate

portable IP is trying to insert network id as physical network id

ensuring network id, physical network id, source network id are properly
set for portable ip in user_ip_address and vlan tables
This commit is contained in:
Murali Reddy 2013-08-06 17:14:01 +05:30
parent 1970a0ddff
commit 86e4d6f80c
1 changed files with 8 additions and 5 deletions

View File

@ -830,11 +830,11 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
Network network =_networkModel.getSystemNetworkByZoneAndTrafficType(dcId, TrafficType.Public);
String range = allocatedPortableIp.getAddress() + "-" + allocatedPortableIp.getAddress();
VlanVO vlan = new VlanVO(VlanType.VirtualNetwork, allocatedPortableIp.getVlan(), allocatedPortableIp.getGateway(),
allocatedPortableIp.getNetmask(), dcId, range, network.getId(), network.getId(), null, null, null);
allocatedPortableIp.getNetmask(), dcId, range, network.getId(), physicalNetworkId, null, null, null);
vlan = _vlanDao.persist(vlan);
// provision the portable IP in to user_ip_address table
ipaddr = new IPAddressVO(new Ip(allocatedPortableIp.getAddress()), dcId, networkId, vpcID, network.getId(),
ipaddr = new IPAddressVO(new Ip(allocatedPortableIp.getAddress()), dcId, networkId, vpcID, physicalNetworkId,
network.getId(), vlan.getId(), true);
ipaddr.setState(State.Allocated);
ipaddr.setAllocatedTime(new Date());
@ -1150,20 +1150,23 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
// in user_ip_address and vlan tables so as to emulate portable IP as provisioned in destination data center
if (srcNetwork.getDataCenterId() != dstNetwork.getDataCenterId()) {
txn.start();
ip.setDataCenterId(dstNetwork.getDataCenterId());
ip.setPhysicalNetworkId(dstNetwork.getPhysicalNetworkId());
_ipAddressDao.update(ipAddrId, ip);
long physicalNetworkId = _networkModel.getDefaultPhysicalNetworkByZoneAndTrafficType(
dstNetwork.getDataCenterId(), TrafficType.Public).getId();
long publicNetworkId =_networkModel.getSystemNetworkByZoneAndTrafficType(
dstNetwork.getDataCenterId(), TrafficType.Public).getId();
ip.setDataCenterId(dstNetwork.getDataCenterId());
ip.setPhysicalNetworkId(physicalNetworkId);
ip.setSourceNetworkId(publicNetworkId);
_ipAddressDao.update(ipAddrId, ip);
VlanVO vlan = _vlanDao.findById(ip.getVlanId());
vlan.setPhysicalNetworkId(physicalNetworkId);
vlan.setNetworkId(publicNetworkId);
vlan.setDataCenterId(dstNetwork.getDataCenterId());
_vlanDao.update(ip.getVlanId(), vlan);
txn.commit();
}