nagaboinaramgopal opened a new pull request, #14036: URL: https://github.com/apache/cloudstack/pull/14036
### Description When a snapshot is copied to an extra primary storage pool (createSnapshot with storagepoolids), copySnapshotOnPool incremented the primary_storage resource count using CallContext.getCallingUserId(). That method's first argument is an account id, but getCallingUserId() returns a user id, and user ids and account ids are independent sequences. So the usage was charged to whatever account happens to share the caller's user id, never to the snapshot's real owner, and the delete path never decrements it. The following guard also compared the user id against Account.ACCOUNT_ID_SYSTEM. Charge the snapshot owner's account id, and use the calling account id for the system check. ### Types of changes - [x] Bug fix (non-breaking change which fixes an issue) ### Feature/Enhancement Scale or Bug Severity #### Bug Severity - [x] Minor ### How Has This Been Tested? Added a unit test asserting the primary_storage count is charged to the snapshot owner's account rather than the calling user id. Also built the standard packages and deployed on a KVM advanced zone. -- 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]
