CreateVPC: validate that the zone exists before checking its attributes

This commit is contained in:
Alena Prokharchyk 2013-06-26 15:25:53 -07:00
parent 7e96bf5f19
commit 079f920494
1 changed files with 4 additions and 0 deletions

View File

@ -595,6 +595,10 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
//Validate zone
DataCenter zone = _configMgr.getZone(zoneId);
if (zone == null) {
throw new InvalidParameterValueException("Can't find zone by id specified");
}
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
// See DataCenterVO.java
PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation since specified Zone is currently disabled");