@@ -1879,17 +1879,21 @@ protected void runInContext() {
18791879 storagePoolStats .put (pool .getId (), (StorageStats )answer );
18801880
18811881 boolean poolNeedsUpdating = false ;
1882+ long capacityBytes = ((StorageStats )answer ).getCapacityBytes ();
1883+ long usedBytes = ((StorageStats )answer ).getByteUsed ();
18821884 // Seems like we have dynamically updated the pool size since the prev. size and the current do not match
1883- if (_storagePoolStats .get (poolId ) != null && _storagePoolStats .get (poolId ).getCapacityBytes () != ((StorageStats )answer ).getCapacityBytes ()) {
1884- if (((StorageStats )answer ).getCapacityBytes () > 0 ) {
1885- pool .setCapacityBytes (((StorageStats )answer ).getCapacityBytes ());
1885+ if ((_storagePoolStats .get (poolId ) != null && _storagePoolStats .get (poolId ).getCapacityBytes () != capacityBytes )
1886+ || pool .getCapacityBytes () != capacityBytes ) {
1887+ if (capacityBytes > 0 ) {
1888+ pool .setCapacityBytes (capacityBytes );
18861889 poolNeedsUpdating = true ;
18871890 } else {
18881891 logger .warn ("Not setting capacity bytes, received " + ((StorageStats )answer ).getCapacityBytes () + " capacity for pool ID " + poolId );
18891892 }
18901893 }
1891- if (pool .getUsedBytes () != ((StorageStats )answer ).getByteUsed () && (pool .getStorageProviderName ().equalsIgnoreCase (DataStoreProvider .DEFAULT_PRIMARY ) || _storageManager .canPoolProvideStorageStats (pool ))) {
1892- pool .setUsedBytes (((StorageStats ) answer ).getByteUsed ());
1894+ if (((_storagePoolStats .get (poolId ) != null && _storagePoolStats .get (poolId ).getByteUsed () != usedBytes )
1895+ || pool .getUsedBytes () != usedBytes ) && (pool .getStorageProviderName ().equalsIgnoreCase (DataStoreProvider .DEFAULT_PRIMARY ) || _storageManager .canPoolProvideStorageStats (pool ))) {
1896+ pool .setUsedBytes (usedBytes );
18931897 poolNeedsUpdating = true ;
18941898 }
18951899 if (poolNeedsUpdating ) {
0 commit comments