Skip to content

Commit 90600f1

Browse files
committed
CLOUDSTACK-6485: private gateway network should not be associated with vpc
Signed-off-by: Daan Hoogland <daan@onecht.net>
1 parent b9c136d commit 90600f1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎server/src/com/cloud/network/NetworkServiceImpl.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3781,9 +3781,9 @@ public Network doInTransaction(TransactionStatus status) throws ResourceAllocati
37813781
} else {
37823782
s_logger.debug("Private network already exists: " + privateNetwork);
37833783
//Do not allow multiple private gateways with same Vlan within a VPC
3784-
if (vpcId.equals(privateNetwork.getVpcId())) {
3785-
throw new InvalidParameterValueException("Private network for the vlan: " + uriString + " and cidr " + cidr + " already exists " + "for Vpc " + vpcId
3786-
+ " in zone " + _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName());
3784+
if (vpcId != null && vpcId.equals(privateNetwork.getVpcId())) {
3785+
throw new InvalidParameterValueException("Private network for the vlan: " + uriString + " and cidr " + cidr + " already exists " + "for Vpc " + vpcId
3786+
+ " in zone " + _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName());
37873787
}
37883788
}
37893789

‎server/src/com/cloud/network/vpc/VpcManagerImpl.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,9 +1590,9 @@ public VpcGatewayVO doInTransaction(TransactionStatus status) throws ResourceAll
15901590
if (privateNtwk == null) {
15911591
s_logger.info("creating new network for vpc " + vpc + " using broadcast uri: " + broadcastUri);
15921592
String networkName = "vpc-" + vpc.getName() + "-privateNetwork";
1593-
privateNtwk =
1594-
_ntwkSvc.createPrivateNetwork(networkName, networkName, physicalNetworkIdFinal, broadcastUri, ipAddress, null, gateway, netmask,
1595-
gatewayOwnerId, vpcId, isSourceNat, networkOfferingId);
1593+
/* vpcid should not be set on the new network as it is not part of the vpc but an outside net */
1594+
privateNtwk = _ntwkSvc.createPrivateNetwork(networkName, networkName, physicalNetworkIdFinal, broadcastUri, ipAddress, null,
1595+
gateway, netmask, gatewayOwnerId, null, isSourceNat, networkOfferingId);
15961596
} else { // create the nic/ip as createPrivateNetwork doesn''t do that work for us now
15971597
s_logger.info("found and using existing network for vpc " + vpc + ": " + broadcastUri);
15981598
DataCenterVO dc = _dcDao.lockRow(physNetFinal.getDataCenterId(), true);

0 commit comments

Comments
 (0)