CreateVPC: validate that the zone exists before checking its attributes
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/079f9204 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/079f9204 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/079f9204 Branch: refs/heads/vmsync Commit: 079f9204941594505bb1ae4dffac2b5e68f13540 Parents: 7e96bf5 Author: Alena Prokharchyk <alena.prokharc...@citrix.com> Authored: Wed Jun 26 15:25:53 2013 -0700 Committer: Alena Prokharchyk <alena.prokharc...@citrix.com> Committed: Wed Jun 26 15:26:20 2013 -0700 ---------------------------------------------------------------------- server/src/com/cloud/network/vpc/VpcManagerImpl.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/079f9204/server/src/com/cloud/network/vpc/VpcManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java index 93413b4..b2cb333 100644 --- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java +++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java @@ -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");