CLOUDSTACK-2305: [Automation] NPE: not able to create volume from snapshot Signed off by : Nitin Mehta <nitin.me...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/55c38465 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/55c38465 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/55c38465 Branch: refs/heads/vmware-datamodel Commit: 55c384651acf3778a4cce57543f79c6e5838fef4 Parents: 49faa00 Author: Sanjay Tripathi <sanjay.tripa...@citrix.com> Authored: Tue May 21 11:49:42 2013 +0530 Committer: Nitin Mehta <nitin.me...@citrix.com> Committed: Tue May 21 12:00:49 2013 +0530 ---------------------------------------------------------------------- .../src/com/cloud/storage/VolumeManagerImpl.java | 16 +++++++------- 1 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/55c38465/server/src/com/cloud/storage/VolumeManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index 55e20cf..4b654eb 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -878,14 +878,6 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { size = diskOffering.getDiskSize(); } - if(displayVolumeEnabled == null){ - displayVolumeEnabled = true; - } else{ - if(!_accountMgr.isRootAdmin(caller.getType())){ - throw new PermissionDeniedException( "Cannot update parameter displayvolume, only admin permitted "); - } - } - if (!validateVolumeSizeRange(size)) {// convert size from mb to gb // for validation throw new InvalidParameterValueException( @@ -917,6 +909,14 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { _accountMgr.checkAccess(caller, null, true, snapshotCheck); } + if(displayVolumeEnabled == null){ + displayVolumeEnabled = true; + } else{ + if(!_accountMgr.isRootAdmin(caller.getType())){ + throw new PermissionDeniedException( "Cannot update parameter displayvolume, only admin permitted "); + } + } + // Check that the resource limit for primary storage won't be exceeded _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.primary_storage, new Long(size));