JoaoJandre commented on code in PR #7441:
URL: https://github.com/apache/cloudstack/pull/7441#discussion_r1263654700


##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -477,13 +477,12 @@ public GetUploadParamsResponse 
doInTransaction(TransactionStatus status) throws
                 //using the existing max upload size configuration
                 
command.setProcessTimeout(NumbersUtil.parseLong(_configDao.getValue("vmware.package.ova.timeout"),
 3600));
                 
command.setMaxUploadSize(_configDao.getValue(Config.MaxUploadVolumeSize.key()));
-                command.setAccountId(vol.getAccountId());
-                Account account = _accountDao.findById(vol.getAccountId());
-                if (account.getType().equals(Account.Type.PROJECT)) {
-                    
command.setDefaultMaxSecondaryStorageInGB(ResourceLimitService.MaxProjectSecondaryStorage.value());
-                } else {
-                    
command.setDefaultMaxSecondaryStorageInGB(ResourceLimitService.MaxAccountSecondaryStorage.value());
-                }
+
+                Long accountId = vol.getAccountId();
+                Account account = _accountDao.findById(accountId);
+
+                
command.setDefaultMaxSecondaryStorageInGB(_resourceLimitMgr.findCorrectResourceLimitForAccount(account,
 ResourceType.secondary_storage));

Review Comment:
   @weizhouapache I did some testing and confirmed this, also tested to see if 
this kind of check is done for other things, like number of vm instances, and 
the domain limit is considered in that case. So I added the domain resource 
limitation check to the secondary storage as well.



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