CLOUDSTACK-6485: private gateway network should not be associated with vpc

Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
Daan Hoogland 2014-04-19 02:25:41 +02:00
parent 08997a9ba3
commit c37df38c83
2 changed files with 3 additions and 2 deletions

View File

@ -3934,7 +3934,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} else {
s_logger.debug("Private network already exists: " + privateNetwork);
//Do not allow multiple private gateways with same Vlan within a VPC
if (vpcId.equals(privateNetwork.getVpcId())) {
if (vpcId != null && vpcId.equals(privateNetwork.getVpcId())) {
throw new InvalidParameterValueException("Private network for the vlan: " + uriString + " and cidr " + cidr + " already exists " + "for Vpc " + vpcId
+ " in zone " + _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName());
}

View File

@ -1428,8 +1428,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
if (privateNtwk == null) {
s_logger.info("creating new network for vpc " + vpc + " using broadcast uri: " + broadcastUri);
String networkName = "vpc-" + vpc.getName() + "-privateNetwork";
/* vpcid should not be set on the new network as it is not part of the vpc but an outside net */
privateNtwk = _ntwkSvc.createPrivateNetwork(networkName, networkName, physicalNetworkIdFinal,
broadcastUri, ipAddress, null, gateway, netmask, gatewayOwnerId, vpcId, isSourceNat, networkOfferingId);
broadcastUri, ipAddress, null, gateway, netmask, gatewayOwnerId, null, isSourceNat, networkOfferingId);
} else { // create the nic/ip as createPrivateNetwork doesn''t do that work for us now
DataCenterVO dc = _dcDao.lockRow(physNetFinal.getDataCenterId(), true);