sureshanaparti commented on a change in pull request #4918:
URL: https://github.com/apache/cloudstack/pull/4918#discussion_r613097354



##########
File path: server/src/main/java/com/cloud/server/StatsCollector.java
##########
@@ -1020,14 +1020,18 @@ protected void runInContext() {
                         if (answer != null && answer.getResult()) {
                             storagePoolStats.put(pool.getId(), 
(StorageStats)answer);
 
+                            boolean poolNeedsUpdating = false;
                             // Seems like we have dynamically updated the pool 
size since the prev. size and the current do not match
-                            if (pool.getCapacityBytes() != 
((StorageStats)answer).getCapacityBytes() ||
-                                    pool.getUsedBytes() != 
((StorageStats)answer).getByteUsed()) {
+                            if (_storagePoolStats.get(poolId) != null && 
_storagePoolStats.get(poolId).getCapacityBytes() != 
((StorageStats)answer).getCapacityBytes()) {

Review comment:
       @rhtyd may be you can update the capacity bytes (from the 
'GetStorageStatsCommand' answer) when it is > 0. Otherwise, better to log a 
WARN message indicating that answer holds the capacity bytes <= 0.
   
   Also, updateStoragePool API shouldn't update the capacity bytes of the pool 
whenever the value passed in the API param "capacitybytes" is <= 0 and < used 
bytes. (haven't tested this, not sure if it is already working this way).




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to