Skip to content

Commit 396a13d

Browse files
author
Koushik Das
committed
CLOUDSTACK-3445: Observing the system alerts "unallocated Local Storage is low in cluster" when Primary storage is Local Storage
Available bytes was getting stored in the used bytes property of local storage pools. As a result of this, for newly added local pools Cloudstack thinks that there is no space available and generated alerts.
1 parent 47acf67 commit 396a13d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ public long getCapacityBytes() {
203203
return capacityBytes;
204204
}
205205

206-
public void setUsedBytes(long available) {
207-
usedBytes = available;
206+
public void setUsedBytes(long usedBytes) {
207+
this.usedBytes = usedBytes;
208208
}
209209

210210
public void setCapacityBytes(long capacityBytes) {

engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public DataStore attachHost(DataStore store, HostScope scope, StoragePoolInfo ex
113113

114114
StoragePoolVO pool = this.dataStoreDao.findById(store.getId());
115115
pool.setScope(scope.getScopeType());
116-
pool.setUsedBytes(existingInfo.getAvailableBytes());
116+
pool.setUsedBytes(existingInfo.getCapacityBytes() - existingInfo.getAvailableBytes());
117117
pool.setCapacityBytes(existingInfo.getCapacityBytes());
118118
pool.setStatus(StoragePoolStatus.Up);
119119
this.dataStoreDao.update(pool.getId(), pool);

0 commit comments

Comments
 (0)