weizhouapache commented on a change in pull request #5428:
URL: https://github.com/apache/cloudstack/pull/5428#discussion_r707190470



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -2575,6 +2581,38 @@ protected void runInContext() {
         }
     }
 
+    private void verifyVmLimits(UserVmVO vmInstance, Map<String,String> 
details) {
+        Long newCpu = Long.valueOf(details.get(VmDetailConstants.CPU_NUMBER));
+        Long newMemory = Long.valueOf(details.get(VmDetailConstants.MEMORY));
+        long currentCpu = 0L;
+        long currentMemory = 0L;
+        List<UserVmDetailVO> vmDetails = 
userVmDetailsDao.listDetails(vmInstance.getId());
+        for (UserVmDetailVO detailVO : vmDetails) {
+            if (VmDetailConstants.CPU_NUMBER.equals(detailVO.getName())) {
+                currentCpu = Long.parseLong(detailVO.getValue());
+            }
+            if (VmDetailConstants.MEMORY.equals(detailVO.getName())) {
+                currentMemory = Long.parseLong(detailVO.getValue());
+            }
+        }
+        Account owner = _accountDao.findById(vmInstance.getAccountId());
+        if (owner == null) {
+            throw new InvalidParameterValueException("The owner of " + 
vmInstance + " does not exist: " + vmInstance.getAccountId());
+        }
+        if (! VirtualMachineManager.ResoureCountRunningVMsonly.value()) {

Review comment:
       if ResoureCountRunningVMsonly is true, it is not needed to check 
resource limit and update rexsource count.
   
   ```
   if (VirtualMachineManager.ResoureCountRunningVMsonly.value()) {
       return;
   }
   ```




-- 
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