You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Sanjay Tripathi <sa...@citrix.com> on 2013/03/07 18:44:10 UTC

Re: Review Request: CLOUDSTACK-1156: Limit Primary and Secondary storage for domain/accounts


> On Feb. 27, 2013, 5:38 a.m., Nitin Mehta wrote:
> > server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java, line 311
> > <https://reviews.apache.org/r/9541/diff/5/?file=262210#file262210line311>
> >
> >     What will happen if u get an exception that the size limit exceeds ?
> >     Do you cleanup the snapshot then ?
> >     
> >     Same question for templates, volumes. Did you consider the volumes which are created on secondary storage ?
> >     
> >     Can we not make all the increment business state transition based - like when volume goes from allocated to ready we increment the volume count and the size etc. ?

In case of size limit exceeds during the check, CS will through resourceAllocation exception right after the check and in case of failure of creating any snapshot or volume, CS decrements the count accordingly.

I considered the volume which is created on secondary storage and this happens only if user uploads a volume. If user attach this volume to any VM, it moves from secondary to primary, so CS decrements secondary storage count and increment primary storage count.

We cannot wait for volume to get into READY state to increment the count because all these calls are async and this will give user some time to create more volume/templates etc. which may have out of his storage limits.

Sailaja has already shared the test case for this feature which covers all these scenarios.


- Sanjay


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/9541/#review17137
-----------------------------------------------------------


On Feb. 27, 2013, 5:21 a.m., Sanjay Tripathi wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/9541/
> -----------------------------------------------------------
> 
> (Updated Feb. 27, 2013, 5:21 a.m.)
> 
> 
> Review request for cloudstack, Devdeep Singh, Sateesh Chodapuneedi, mice xia, and Min Chen.
> 
> 
> Description
> -------
> 
> CLOUDSTACK-1156: Limit Primary and Secondary storage for domain/accounts
>     
>     Addition of two new resource types i.e. Primary and Secondary storage space in the existing pool of
>     resource types.
>     Added methods to set the limits on these resources using updateResourceLimit
>     API command and to get a count using updateResourceCount. Also added calls in the
>     Templates, Volumes, Snapshots life cycle to check these limits and to increment/decrement the new
>     resource types
>     
>     Resource Name          :: Resource type number
>         Primary Storage               10
>         Secondary Storage             11
>     
>     Also added jUnit Tests for the same.
> 
> 
> This addresses bug CLOUDSTACK-1156.
> 
> 
> Diffs
> -----
> 
>   api/src/com/cloud/configuration/Resource.java 7614c8a 
>   api/src/com/cloud/storage/VolumeApiService.java 8517988 
>   api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java f6d3a98 
>   api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java 0039f62 
>   api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java 955727a 
>   api/src/org/apache/cloudstack/api/response/AccountResponse.java 9a98a35 
>   api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java a7fbbf2 
>   api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java b444e7a 
>   server/src/com/cloud/api/ApiResponseHelper.java eafee8a 
>   server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java 898bafc 
>   server/src/com/cloud/api/query/vo/AccountJoinVO.java cd7231c 
>   server/src/com/cloud/baremetal/BareMetalTemplateAdapter.java 0cf19fb 
>   server/src/com/cloud/configuration/Config.java eb6fb24 
>   server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java 7ff06af 
>   server/src/com/cloud/storage/VolumeManager.java af3cbbf 
>   server/src/com/cloud/storage/VolumeManagerImpl.java a69607f 
>   server/src/com/cloud/storage/dao/SnapshotDao.java 0e378a7 
>   server/src/com/cloud/storage/dao/SnapshotDaoImpl.java 5b3f273 
>   server/src/com/cloud/storage/dao/VolumeDao.java d7a2667 
>   server/src/com/cloud/storage/dao/VolumeDaoImpl.java ca3b82a 
>   server/src/com/cloud/storage/download/DownloadMonitorImpl.java 0bc89e3 
>   server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java ed48bd1 
>   server/src/com/cloud/template/HyervisorTemplateAdapter.java ad41af5 
>   server/src/com/cloud/template/TemplateManagerImpl.java 29659d3 
>   server/src/com/cloud/vm/UserVmManagerImpl.java c2bba63 
>   server/test/com/cloud/resourcelimit/ResourceLimitManagerImplTest.java d311ad3 
>   server/test/com/cloud/vpc/MockResourceLimitManagerImpl.java b9fc861 
>   setup/db/db/schema-40to410.sql 59b2a7d 
>   setup/db/db/schema-410to420.sql 4349bd0 
>   utils/src/com/cloud/utils/UriUtils.java a8b5ccb 
> 
> Diff: https://reviews.apache.org/r/9541/diff/
> 
> 
> Testing
> -------
> 
> Tested life cycle of templates, volumes, snapshots, vm on my local CloudStack setup.
> 
> 
> Thanks,
> 
> Sanjay Tripathi
> 
>