mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
VPC: don't allow vpcs for the same account with overlapping cidrs
This commit is contained in:
parent
83f566cfe7
commit
d6774e6a86
@ -543,6 +543,15 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//don't allow overlapping CIDRS for the VPCs of the same account
|
||||||
|
List<? extends Vpc> vpcs = getVpcsForAccount(vpcOwner.getId());
|
||||||
|
for (Vpc vpc : vpcs) {
|
||||||
|
if (NetUtils.isNetworksOverlap(cidr, vpc.getCidr())) {
|
||||||
|
throw new InvalidParameterValueException("Account already has vpc with cidr " + vpc.getCidr() +
|
||||||
|
" that overlaps the cidr specified: " + cidr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VpcVO vpc = new VpcVO (zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(), vpcOffId, cidr,
|
VpcVO vpc = new VpcVO (zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(), vpcOffId, cidr,
|
||||||
networkDomain);
|
networkDomain);
|
||||||
vpc = _vpcDao.persist(vpc);
|
vpc = _vpcDao.persist(vpc);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user