vishesh92 commented on code in PR #8302:
URL: https://github.com/apache/cloudstack/pull/8302#discussion_r1421919416
##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -689,18 +689,28 @@ private void resourceLimitCheck(Account owner, Boolean
displayVm, Long cpu, Long
}
protected void resourceCountIncrement(long accountId, Boolean displayVm,
Long cpu, Long memory) {
- if (! VirtualMachineManager.ResourceCountRunningVMsonly.value()) {
- _resourceLimitMgr.incrementResourceCount(accountId,
ResourceType.user_vm, displayVm);
- _resourceLimitMgr.incrementResourceCount(accountId,
ResourceType.cpu, displayVm, cpu);
- _resourceLimitMgr.incrementResourceCount(accountId,
ResourceType.memory, displayVm, memory);
+ if (!VirtualMachineManager.ResourceCountRunningVMsonly.value()) {
+ Transaction.execute(new TransactionCallbackNoReturn() {
Review Comment:
Another way to do this without incrementing all three in a transaction would
require adding columns for each reservation type (`user_vm`, `cpu`, `memory`)
in `user_vm` table since `cpu` & `memory` are calculated using the `user_vm`
table.
--
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]