Skip to content

Commit e790167

Browse files
committed
server: create DB entry for storage pool capacity when create storage pool
1 parent 3f84b9a commit e790167

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

server/src/main/java/com/cloud/storage/StorageManagerImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,15 @@ public PrimaryDataStoreInfo createPool(CreateStoragePoolCmd cmd) throws Resource
757757
throw new CloudRuntimeException("Failed to add data store: " + e.getMessage(), e);
758758
}
759759

760+
// create entry for storage pool capacity
761+
StoragePoolVO pool = _storagePoolDao.findById(store.getId());
762+
long disk = _capacityMgr.getAllocatedPoolCapacity(pool, null);
763+
if (pool.isShared()) {
764+
createCapacityEntry(pool, Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED, disk);
765+
} else {
766+
createCapacityEntry(pool, Capacity.CAPACITY_TYPE_LOCAL_STORAGE, disk);
767+
}
768+
760769
return (PrimaryDataStoreInfo)_dataStoreMgr.getDataStore(store.getId(), DataStoreRole.Primary);
761770
}
762771

0 commit comments

Comments
 (0)