9797import org .apache .cloudstack .storage .datastore .db .VolumeDataStoreDao ;
9898import org .apache .cloudstack .storage .datastore .db .VolumeDataStoreVO ;
9999import org .apache .cloudstack .storage .image .datastore .ImageStoreEntity ;
100- import org .apache .cloudstack .utils .bytescale .ByteScaleUtils ;
101100import org .apache .cloudstack .utils .identity .ManagementServerNode ;
102101import org .apache .cloudstack .utils .imagestore .ImageStoreUtil ;
103102import org .apache .cloudstack .utils .jsinterpreter .TagAsRuleHelper ;
@@ -3796,7 +3795,7 @@ public Volume assignVolumeToAccount(AssignVolumeCmd command) throws ResourceAllo
37963795 _accountMgr .checkAccess (caller , null , true , oldAccount );
37973796 _accountMgr .checkAccess (caller , null , true , newAccount );
37983797
3799- _resourceLimitMgr .checkResourceLimit (newAccount , ResourceType .volume , ByteScaleUtils . bytesToGibibytes ( volume . getSize ()) );
3798+ _resourceLimitMgr .checkResourceLimit (newAccount , ResourceType .volume );
38003799 _resourceLimitMgr .checkResourceLimit (newAccount , ResourceType .primary_storage , volume .getSize ());
38013800
38023801 Transaction .execute (new TransactionCallbackNoReturn () {
@@ -3812,14 +3811,14 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
38123811 protected void updateVolumeAccount (Account oldAccount , VolumeVO volume , Account newAccount ) {
38133812 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VOLUME_DELETE , volume .getAccountId (), volume .getDataCenterId (), volume .getId (), volume .getName (),
38143813 Volume .class .getName (), volume .getUuid (), volume .isDisplayVolume ());
3815- _resourceLimitMgr .decrementResourceCount (oldAccount .getAccountId (), ResourceType .volume , ByteScaleUtils . bytesToGibibytes ( volume . getSize ()) );
3814+ _resourceLimitMgr .decrementResourceCount (oldAccount .getAccountId (), ResourceType .volume );
38163815 _resourceLimitMgr .decrementResourceCount (oldAccount .getAccountId (), ResourceType .primary_storage , volume .getSize ());
38173816
38183817 volume .setAccountId (newAccount .getAccountId ());
38193818 volume .setDomainId (newAccount .getDomainId ());
38203819 _volsDao .persist (volume );
38213820
3822- _resourceLimitMgr .incrementResourceCount (newAccount .getAccountId (), ResourceType .volume , ByteScaleUtils . bytesToGibibytes ( volume . getSize ()) );
3821+ _resourceLimitMgr .incrementResourceCount (newAccount .getAccountId (), ResourceType .volume );
38233822 _resourceLimitMgr .incrementResourceCount (newAccount .getAccountId (), ResourceType .primary_storage , volume .getSize ());
38243823
38253824 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VOLUME_CREATE , volume .getAccountId (), volume .getDataCenterId (), volume .getId (), volume .getName (),
0 commit comments