Damans227 commented on code in PR #14036:
URL: https://github.com/apache/cloudstack/pull/14036#discussion_r4168163829


##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java:
##########
@@ -1780,8 +1780,8 @@ private boolean copySnapshotOnPool(SnapshotInfo snapshot, 
SnapshotStrategy snaps
                 return false;
             }
             snapshotZoneDao.addSnapshotToZone(snapshot.getId(), 
snapshotOnStore.getDataCenterId());
-            
_resourceLimitMgr.incrementResourceCount(CallContext.current().getCallingUserId(),
 ResourceType.primary_storage, snapshot.getSize());
-            if (CallContext.current().getCallingUserId() != 
Account.ACCOUNT_ID_SYSTEM) {
+            _resourceLimitMgr.incrementResourceCount(snapshot.getAccountId(), 
ResourceType.primary_storage, snapshot.getSize());
+            if (CallContext.current().getCallingAccountId() != 
Account.ACCOUNT_ID_SYSTEM) {
                 SnapshotVO snapshotVO = 
_snapshotDao.findByIdIncludingRemoved(snapshot.getSnapshotId());
                 
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_COPY, 
CallContext.current().getCallingAccountId(), snapshotOnStore.getDataCenterId(), 
snapshotVO.getId(), null, null, null, snapshotVO.getSize(),

Review Comment:
   should the usage record go to the snapshot owner too? right now if an admin 
makes the copy, the admin gets billed for it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to