mirror of https://github.com/apache/cloudstack.git
server: Stat collector solidfire capacity fix (#4918)
Fixes regression introduced in 71c5dbcf49
which would cause capacity bytes of certain pools to be update which
shouldn't get updated by StatsCollector such as solidfire.
Fixes #4911
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
8edd709cad
commit
5051fde952
|
|
@ -1020,14 +1020,22 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
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()) {
|
||||
pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
|
||||
if (pool.getStorageProviderName().equalsIgnoreCase(DataStoreProvider.DEFAULT_PRIMARY)) {
|
||||
pool.setUsedBytes(((StorageStats) answer).getByteUsed());
|
||||
pool.setUpdateTime(new Date());
|
||||
if (_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()) {
|
||||
if (((StorageStats)answer).getCapacityBytes() > 0) {
|
||||
pool.setCapacityBytes(((StorageStats)answer).getCapacityBytes());
|
||||
poolNeedsUpdating = true;
|
||||
} else {
|
||||
s_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)) {
|
||||
pool.setUsedBytes(((StorageStats) answer).getByteUsed());
|
||||
poolNeedsUpdating = true;
|
||||
}
|
||||
if (poolNeedsUpdating) {
|
||||
pool.setUpdateTime(new Date());
|
||||
_storagePoolDao.update(pool.getId(), pool);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue