DaanHoogland commented on a change in pull request #2829: CLOUDSTACK-9473: 
storage pool capacity check when volume is resized or migrated
URL: https://github.com/apache/cloudstack/pull/2829#discussion_r214034811
 
 

 ##########
 File path: server/src/com/cloud/storage/StorageManagerImpl.java
 ##########
 @@ -1830,12 +1830,37 @@ public boolean storagePoolHasEnoughSpace(List<Volume> 
volumes, StoragePool pool,
             }
         }
 
+        return checkPoolforSpace(pool, allocatedSizeWithTemplate, 
totalAskingSize);
+    }
+
+    @Override
+    public boolean storagePoolHasEnoughSpaceForResize(StoragePool pool, long 
currentSize, long newSiz) {
+        if (!checkUsagedSpace(pool)) {
+            return false;
+        }
+        if (s_logger.isDebugEnabled()) {
 
 Review comment:
   "bla" + "blob" is a costly operation, basically to memcpy()s. 
String.format() as well in comparison. We don't want those operations performed 
if we don't end up using the result in a log statement. so the boolean check 
potentially saves us a lot of cpu cycles, especially in the debug() and trace() 
cases.

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