From e72d38b15df297847f09b9fd9e4606b788f52377 Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Tue, 4 Oct 2011 17:56:36 -0700 Subject: [PATCH] Revert "bug 11604: Assign guest ip for each router" This reverts commit 42ab3c94c210d5a29289a5dfd0e44ae99c427f8b. The commit may not fit for our new network as service framework, because we would make single router and redundant router as two different service provider, so the change of network offering should clean up the old network and then setup new one. Make single router work as redundant router later make no sense in such condition. --- .../router/VirtualNetworkApplianceManagerImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index eb6d9d41d14..08612bef7b8 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1073,7 +1073,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian List publicNetworks = _networkMgr.setupNetwork(_systemAcct, publicOffering, plan, null, null, false, false); networks.add(new Pair(publicNetworks.get(0), defaultNic)); NicProfile gatewayNic = new NicProfile(); - gatewayNic.setIp4Address(_networkMgr.acquireGuestIpAddress(guestNetwork, null)); + if (isRedundant) { + gatewayNic.setIp4Address(_networkMgr.acquireGuestIpAddress(guestNetwork, null)); + } else { + gatewayNic.setIp4Address(guestNetwork.getGateway()); + } gatewayNic.setBroadcastUri(guestNetwork.getBroadcastUri()); gatewayNic.setBroadcastType(guestNetwork.getBroadcastDomainType()); gatewayNic.setIsolationUri(guestNetwork.getBroadcastUri()); @@ -1392,12 +1396,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian for (NicProfile nic : profile.getNics()) { int deviceId = nic.getDeviceId(); - 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("ip=").append(nic.getIp4Address()); buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask()); if (nic.isDefaultNic()) { buf.append(" gateway=").append(nic.getGateway()); @@ -1444,6 +1443,7 @@ 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);