bug 11604: Assign guest ip for each router

Then every router would have one guest ip. The gateway ip would be used if the
router is not redundant, otherwise the guest ip would be used for guest network.
This commit is contained in:
Sheng Yang 2011-09-29 17:26:09 -07:00
parent 143ec3a4c5
commit 36511ab6fd
1 changed files with 7 additions and 7 deletions

View File

@ -1073,11 +1073,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
List<NetworkVO> publicNetworks = _networkMgr.setupNetwork(_systemAcct, publicOffering, plan, null, null, false, false);
networks.add(new Pair<NetworkVO, NicProfile>(publicNetworks.get(0), defaultNic));
NicProfile gatewayNic = new NicProfile();
if (isRedundant) {
gatewayNic.setIp4Address(_networkMgr.acquireGuestIpAddress(guestNetwork, null));
} else {
gatewayNic.setIp4Address(guestNetwork.getGateway());
}
gatewayNic.setIp4Address(_networkMgr.acquireGuestIpAddress(guestNetwork, null));
gatewayNic.setBroadcastUri(guestNetwork.getBroadcastUri());
gatewayNic.setBroadcastType(guestNetwork.getBroadcastDomainType());
gatewayNic.setIsolationUri(guestNetwork.getBroadcastUri());
@ -1396,7 +1392,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
for (NicProfile nic : profile.getNics()) {
int deviceId = nic.getDeviceId();
buf.append(" eth").append(deviceId).append("ip=").append(nic.getIp4Address());
Network net = _networkMgr.getNetwork(nic.getNetworkId());
String guestIp = nic.getIp4Address();
if (nic.getTrafficType() == TrafficType.Guest && !router.getIsRedundantRouter()) {
guestIp = net.getGateway();
}
buf.append(" eth").append(deviceId).append("ip=").append(guestIp);
buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask());
if (nic.isDefaultNic()) {
buf.append(" gateway=").append(nic.getGateway());
@ -1443,7 +1444,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
controlNic = nic;
} else if (nic.getTrafficType() == TrafficType.Guest && isRedundant) {
Network net = _networkMgr.getNetwork(nic.getNetworkId());
buf.append(" guestgw=").append(net.getGateway());
String brd = NetUtils.long2Ip(NetUtils.ip2Long(nic.getIp4Address()) | ~NetUtils.ip2Long(nic.getNetmask()));
buf.append(" guestbrd=").append(brd);