rafaelweingartner commented on a change in pull request #2270: CLOUDSTACK-10085 
: Upload volume from local fails when global config 
max.account.seconday.storage is set to -1
URL: https://github.com/apache/cloudstack/pull/2270#discussion_r146835526
 
 

 ##########
 File path: 
services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
 ##########
 @@ -2809,7 +2808,7 @@ private synchronized void 
checkSecondaryStorageResourceLimit(TemplateOrVolumePos
         int accountDirSizeInGB = getSizeInGB(accountTemplateDirSize + 
accountSnapshotDirSize + accountVolumeDirSize);
         int defaultMaxAccountSecondaryStorageInGB = 
Integer.parseInt(cmd.getDefaultMaxAccountSecondaryStorage());
 
-        if ((accountDirSizeInGB + contentLengthInGB) > 
defaultMaxAccountSecondaryStorageInGB) {
+        if (defaultMaxAccountSecondaryStorageInGB != 
Resource.RESOURCE_UNLIMITED && (accountDirSizeInGB + contentLengthInGB) > 
defaultMaxAccountSecondaryStorageInGB) {
 
 Review comment:
   @niteshsarda thanks for the fix.
   To improve this PR to an even higher level, how do you feel about extracting 
the condition of the `if` to a method? 
   
   Then, this method can receive test cases and Java doc explaining when it 
returns true or false. 
   This can facilitate code maintenance in the future and also to reduce the 
bar for newcomers.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to