Copilot commented on code in PR #12779:
URL: https://github.com/apache/cloudstack/pull/12779#discussion_r3194541808
##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -2904,6 +2872,11 @@ protected void verifyVmLimits(UserVmVO vmInstance,
Map<String, String> details)
} else if (newMemory > 0 && currentMemory > newMemory){
_resourceLimitMgr.decrementVmMemoryResourceCount(owner.getAccountId(),
vmInstance.isDisplay(), svcOffering, template, currentMemory - newMemory);
}
+ if (newGpu > currentGpu) {
+
_resourceLimitMgr.incrementVmGpuResourceCount(owner.getAccountId(),
vmInstance.isDisplay(), svcOffering, template, newGpu - currentGpu);
+ } else if (newGpu > 0 && currentGpu > newGpu){
Review Comment:
The GPU resource count decrement is guarded by `newGpu > 0`. If a VM moves
from a GPU offering to a non-GPU offering (gpuCount becomes 0/null), this will
skip the decrement and leave GPU limits over-counted. Consider decrementing
whenever `currentGpu > newGpu` (difference > 0), even when `newGpu` is 0.
--
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]