VPC: CS-15805 - guest cidr should be RFC1918 complient

This commit is contained in:
Alena Prokharchyk 2012-08-13 16:58:45 -07:00
parent f0baaf6a22
commit b3760350fe
1 changed files with 5 additions and 10 deletions

View File

@ -583,6 +583,11 @@ public class VpcManagerImpl implements VpcManager, Manager{
if (!NetUtils.isValidCIDR(cidr)) {
throw new InvalidParameterValueException("Invalid CIDR specified " + cidr);
}
//cidr has to be RFC 1918 complient
if (!NetUtils.validateGuestCidr(cidr)) {
throw new InvalidParameterValueException("Guest Cidr " + cidr + " is not RFC1918 compliant");
}
// validate network domain
if (!NetUtils.verifyDomainName(networkDomain)) {
@ -593,16 +598,6 @@ public class VpcManagerImpl implements VpcManager, Manager{
+ "and the hyphen ('-'); can't start or end with \"-\"");
}
// //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, null);
// }
// }
Transaction txn = Transaction.currentTxn();
txn.start();
VpcVO vpc = new VpcVO (zoneId, vpcName, displayText, vpcOwner.getId(), vpcOwner.getDomainId(), vpcOffId, cidr,