You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/07/04 02:27:52 UTC
[2/6] git commit: VPC: CS-15426 - In Basic zone always pass control
nic when prepare nics for the VR
VPC: CS-15426 - In Basic zone always pass control nic when prepare nics for the VR
Conflicts:
server/src/com/cloud/network/NetworkManagerImpl.java
server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/07d478d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/07d478d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/07d478d8
Branch: refs/heads/vpc
Commit: 07d478d8363cb2bfc0861cd9c21b357fce55860b
Parents: 5afa83a
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Jul 3 17:09:46 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Jul 3 17:27:46 2012 -0700
----------------------------------------------------------------------
.../src/com/cloud/network/NetworkManagerImpl.java | 9 ++-
.../com/cloud/network/guru/ControlNetworkGuru.java | 4 +-
.../router/VirtualNetworkApplianceManagerImpl.java | 50 ++++++---------
.../VpcVirtualNetworkApplianceManagerImpl.java | 2 +-
4 files changed, 27 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/07d478d8/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index c31b2b0..8f46299 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -2193,7 +2193,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
URI isolationUri = nic.getIsolationUri();
profile = new NicProfile(nic, network, broadcastUri, isolationUri,
- networkRate, isSecurityGroupSupportedInNetwork(network), getNetworkTag(vmProfile.getHypervisorType(), network));
+
+ networkRate, isSecurityGroupSupportedInNetwork(network), getNetworkTag(vmProfile.getHypervisorType(), network));
guru.reserve(profile, network, vmProfile, dest, context);
nic.setIp4Address(profile.getIp4Address());
nic.setAddressFormat(profile.getFormat());
@@ -2213,17 +2214,17 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
updateNic(nic, network.getId(), 1);
} else {
profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(),
- networkRate, isSecurityGroupSupportedInNetwork(network), getNetworkTag(vmProfile.getHypervisorType(), network));
+ networkRate, isSecurityGroupSupportedInNetwork(network), getNetworkTag(vmProfile.getHypervisorType(), network));
guru.updateNicProfile(profile, network);
nic.setState(Nic.State.Reserved);
updateNic(nic, network.getId(), 1);
}
-
+
for (NetworkElement element : _networkElements) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Asking " + element.getName() + " to prepare for " + nic);
}
- prepareElement(element, network, profile, vmProfile, dest, context);
+ prepareElement(element, network, profile, vmProfile, dest, context);
}
profile.setSecurityGroupEnabled(isSecurityGroupSupportedInNetwork(network));
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/07d478d8/server/src/com/cloud/network/guru/ControlNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
index 4427be7..ed0064e 100755
--- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
@@ -21,8 +21,8 @@ import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.deploy.DeployDestination;
@@ -36,12 +36,10 @@ import com.cloud.network.NetworkProfile;
import com.cloud.network.NetworkVO;
import com.cloud.network.Networks.AddressFormat;
import com.cloud.network.Networks.BroadcastDomainType;
-import com.cloud.network.Networks.IsolationType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
-import com.cloud.utils.Pair;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.component.Inject;
import com.cloud.utils.exception.CloudRuntimeException;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/07d478d8/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 0088adc..bbaef5e 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1254,7 +1254,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
if (_networkMgr.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType() == Network.GuestType.Shared) {
owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
}
-
//Check if public network has to be set on VR
boolean publicNetwork = false;
if (_networkMgr.isProviderSupportServiceInNetwork(guestNetwork.getId(), Service.SourceNat, Provider.VirtualRouter)) {
@@ -1268,25 +1267,18 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
Long offeringId = _networkOfferingDao.findById(guestNetwork.getNetworkOfferingId()).getServiceOfferingId();
if (offeringId == null) {
offeringId = _offering.getId();
- }
+ }
PublicIp sourceNatIp = null;
- if (publicNetwork) {
+ if (publicNetwork) {
sourceNatIp = _networkMgr.assignSourceNatIpAddressToGuestNetwork(owner, guestNetwork);
}
-
- //Check if control network has to be set on VR
- boolean controlNetwork = true;
- if ( dest.getDataCenter().getNetworkType() == NetworkType.Basic ) {
- // in basic mode, use private network as control network
- controlNetwork = false;
- }
//3) deploy virtual router(s)
int count = routerCount - routers.size();
for (int i = 0; i < count; i++) {
DomainRouterVO router = deployRouter(owner, dest, plan, params, isRedundant, vrProvider, offeringId,
- null, sourceNatIp, publicNetwork, controlNetwork, guestNetwork, new Pair<Boolean, PublicIp>(publicNetwork, sourceNatIp));
+ null, sourceNatIp, publicNetwork, guestNetwork, new Pair<Boolean, PublicIp>(publicNetwork, sourceNatIp));
//add router to router network map
if (!_routerDao.isRouterPartOfGuestNetwork(router.getId(), network.getId())) {
DomainRouterVO routerVO = _routerDao.findById(router.getId());
@@ -1304,8 +1296,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
protected DomainRouterVO deployRouter(Account owner, DeployDestination dest, DeploymentPlan plan, Map<Param, Object> params,
boolean isRedundant, VirtualRouterProvider vrProvider, long svcOffId,
- Long vpcId, PublicIp sourceNatIp, boolean setupPublicNetwork, boolean setupControlNetwork, Network guestNetwork,
- Pair<Boolean, PublicIp> publicNetwork) throws ConcurrentOperationException,
+ Long vpcId, PublicIp sourceNatIp, boolean setupPublicNetwork, Network guestNetwork, Pair<Boolean, PublicIp> publicNetwork) throws ConcurrentOperationException,
InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException,
StorageUnavailableException, ResourceUnavailableException {
@@ -1315,8 +1306,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
//1) Create router networks
- List<Pair<NetworkVO, NicProfile>> networks = createRouterNetworks(owner, isRedundant, plan, setupControlNetwork,
- guestNetwork, publicNetwork);
+ List<Pair<NetworkVO, NicProfile>> networks = createRouterNetworks(owner, isRedundant, plan, guestNetwork,
+ publicNetwork);
ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId);
@@ -1328,7 +1319,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
if (defaults != HypervisorType.None) {
supportedHypervisors.add(defaults);
}
-
+
if (dest.getCluster() != null) {
if (dest.getCluster().getHypervisorType() == HypervisorType.Ovm) {
supportedHypervisors.add(getClusterToStartDomainRouterForOvm(dest.getCluster().getPodId()));
@@ -1337,9 +1328,9 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
} else {
supportedHypervisors = _resourceMgr.getSupportedHypervisorTypes(dest.getDataCenter().getId(), true,
- plan.getPodId());
+ plan.getPodId());
}
-
+
if (supportedHypervisors.isEmpty()) {
if (plan.getPodId() != null) {
throw new InsufficientServerCapacityException("Unable to create virtual router, " +
@@ -1348,7 +1339,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
throw new InsufficientServerCapacityException("Unable to create virtual router, " +
"there are no clusters in the zone ", DataCenter.class, dest.getDataCenter().getId());
}
-
+
int allocateRetry = 0;
int startRetry = 0;
DomainRouterVO router = null;
@@ -1392,7 +1383,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
} catch (InsufficientCapacityException ex) {
if (startRetry < 2 && iter.hasNext()) {
s_logger.debug("Failed to start the domR " + router + " with hypervisor type " + hType + ", " +
- "destroying it and recreating one more time");
+ "destroying it and recreating one more time");
//destroy the router
destroyRouter(router.getId());
continue;
@@ -1403,12 +1394,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
startRetry++;
}
}
-
+
return router;
}
protected List<Pair<NetworkVO, NicProfile>> createRouterNetworks(Account owner, boolean isRedundant,
- DeploymentPlan plan, boolean setupControlNetwork, Network guestNetwork, Pair<Boolean, PublicIp> publicNetwork) throws ConcurrentOperationException,
+ DeploymentPlan plan, Network guestNetwork, Pair<Boolean, PublicIp> publicNetwork) throws ConcurrentOperationException,
InsufficientAddressCapacityException {
@@ -1454,15 +1445,14 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
networks.add(new Pair<NetworkVO, NicProfile>((NetworkVO) guestNetwork, gatewayNic));
hasGuestNetwork = true;
}
-
+
//2) Control network
- if (setupControlNetwork) {
- s_logger.debug("Adding nic for Virtual Router in Control network ");
- List<NetworkOfferingVO> offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemControlNetwork);
- NetworkOfferingVO controlOffering = offerings.get(0);
- NetworkVO controlConfig = _networkMgr.setupNetwork(_systemAcct, controlOffering, plan, null, null, false).get(0);
- networks.add(new Pair<NetworkVO, NicProfile>(controlConfig, null));
- }
+ s_logger.debug("Adding nic for Virtual Router in Control network ");
+ List<NetworkOfferingVO> offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemControlNetwork);
+ NetworkOfferingVO controlOffering = offerings.get(0);
+ NetworkVO controlConfig = _networkMgr.setupNetwork(_systemAcct, controlOffering, plan, null, null, false).get(0);
+ networks.add(new Pair<NetworkVO, NicProfile>(controlConfig, null));
+
//3) Public network
if (setupPublicNetwork) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/07d478d8/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 9966e65..7c30c80 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -399,7 +399,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
DomainRouterVO router =
super.deployRouter(owner, dest, plan, params, isRedundant, vrProvider, svcOffId, vpcId, sourceNatIp,
- false, true, null, null);
+ false, null, null);
//Plug public nic
if (router != null && sourceNatIp != null) {