Storage pool stats update (#383)

* Update PowerFlex storage stats on host connect (if any changes in capacity / used bytes)

* Sync the pool stats in DB with the actual stats from stats collector

* Updated capacityBytes check

* Revert "Updated capacityBytes check"

This reverts commit 3ffb17b2c4b3c794e5d0dbf4108d43255b4fbcca.

* Revert "Update PowerFlex storage stats on host connect (if any changes in capacity / used bytes)"

This reverts commit 9e473aed4c589b91f62cbe2fd135dc25e0adc1c3.
This commit is contained in:
Suresh Kumar Anaparti 2024-02-29 15:26:00 +05:30 committed by GitHub
parent 747d1101c1
commit ae6d0fb2d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -1710,17 +1710,21 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
storagePoolStats.put(pool.getId(), (StorageStats)answer);
boolean poolNeedsUpdating = false;
long capacityBytes = ((StorageStats)answer).getCapacityBytes();
long usedBytes = ((StorageStats)answer).getByteUsed();
// Seems like we have dynamically updated the pool size since the prev. size and the current do not match
if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
if (((StorageStats)answer).getCapacityBytes() > 0) {
pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
if ((_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != capacityBytes)
|| pool.getCapacityBytes() != capacityBytes) {
if (capacityBytes > 0) {
pool.setCapacityBytes(capacityBytes);
poolNeedsUpdating = true;
} else {
LOGGER.warn("Not setting capacity bytes, received " + ((StorageStats)answer).getCapacityBytes() + " capacity for pool ID " + poolId);
}
}
if (pool.getUsedBytes() != ((StorageStats)answer).getByteUsed() && (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY) || _storageManager.canPoolProvideStorageStats(pool))) {
pool.setUsedBytes(((StorageStats) answer).getByteUsed());
if (((_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getByteUsed() != usedBytes)
|| pool.getUsedBytes() != usedBytes) && (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY) || _storageManager.canPoolProvideStorageStats(pool))) {
pool.setUsedBytes(usedBytes);
poolNeedsUpdating = true;
}
if (poolNeedsUpdating) {