nagaboinaramgopal commented on code in PR #14036:
URL: https://github.com/apache/cloudstack/pull/14036#discussion_r4168205490
##########
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:
Good catch, thank you. You're right, that was inconsistent: the resource
count went to the owner but the usage record used the caller. Fixed in
f2dfb468b4 so the usage event is attributed to the snapshot owner
(`snapshot.getAccountId()`), which also matches the snapshot create and delete
events.
--
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]