100100import org .apache .cloudstack .storage .datastore .db .VolumeDataStoreDao ;
101101import org .apache .cloudstack .storage .datastore .db .VolumeDataStoreVO ;
102102import org .apache .cloudstack .storage .image .datastore .ImageStoreEntity ;
103- import org .apache .cloudstack .utils .bytescale .ByteScaleUtils ;
104103import org .apache .cloudstack .utils .identity .ManagementServerNode ;
105104import org .apache .cloudstack .utils .imagestore .ImageStoreUtil ;
106105import org .apache .cloudstack .utils .reflectiontostringbuilderutils .ReflectionToStringBuilderUtils ;
@@ -3784,7 +3783,7 @@ public Volume assignVolumeToAccount(AssignVolumeCmd command) throws ResourceAllo
37843783 _accountMgr .checkAccess (caller , null , true , oldAccount );
37853784 _accountMgr .checkAccess (caller , null , true , newAccount );
37863785
3787- _resourceLimitMgr .checkResourceLimit (newAccount , ResourceType .volume , ByteScaleUtils . bytesToGibibytes ( volume . getSize ()) );
3786+ _resourceLimitMgr .checkResourceLimit (newAccount , ResourceType .volume );
37883787 _resourceLimitMgr .checkResourceLimit (newAccount , ResourceType .primary_storage , volume .getSize ());
37893788
37903789 Transaction .execute (new TransactionCallbackNoReturn () {
@@ -3800,14 +3799,14 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
38003799 protected void updateVolumeAccount (Account oldAccount , VolumeVO volume , Account newAccount ) {
38013800 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VOLUME_DELETE , volume .getAccountId (), volume .getDataCenterId (), volume .getId (), volume .getName (),
38023801 Volume .class .getName (), volume .getUuid (), volume .isDisplayVolume ());
3803- _resourceLimitMgr .decrementResourceCount (oldAccount .getAccountId (), ResourceType .volume , ByteScaleUtils . bytesToGibibytes ( volume . getSize ()) );
3802+ _resourceLimitMgr .decrementResourceCount (oldAccount .getAccountId (), ResourceType .volume );
38043803 _resourceLimitMgr .decrementResourceCount (oldAccount .getAccountId (), ResourceType .primary_storage , volume .getSize ());
38053804
38063805 volume .setAccountId (newAccount .getAccountId ());
38073806 volume .setDomainId (newAccount .getDomainId ());
38083807 _volsDao .persist (volume );
38093808
3810- _resourceLimitMgr .incrementResourceCount (newAccount .getAccountId (), ResourceType .volume , ByteScaleUtils . bytesToGibibytes ( volume . getSize ()) );
3809+ _resourceLimitMgr .incrementResourceCount (newAccount .getAccountId (), ResourceType .volume );
38113810 _resourceLimitMgr .incrementResourceCount (newAccount .getAccountId (), ResourceType .primary_storage , volume .getSize ());
38123811
38133812 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VOLUME_CREATE , volume .getAccountId (), volume .getDataCenterId (), volume .getId (), volume .getName (),
0 commit comments