Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions server/src/main/java/com/cloud/storage/StorageManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1286,27 +1286,25 @@ public PrimaryDataStoreInfo updateStoragePool(UpdateStoragePoolCmd cmd) throws I
}

if (changes) {
StoragePoolVO storagePool = _storagePoolDao.findById(id);
DataStoreProvider dataStoreProvider = _dataStoreProviderMgr.getDataStoreProvider(storagePool.getStorageProviderName());
DataStoreProvider dataStoreProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
DataStoreLifeCycle dataStoreLifeCycle = dataStoreProvider.getDataStoreLifeCycle();

if (dataStoreLifeCycle instanceof PrimaryDataStoreLifeCycle) {
if (updatedCapacityBytes != null) {
details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, updatedCapacityBytes != null ? String.valueOf(updatedCapacityBytes) : null);
_storagePoolDao.updateCapacityBytes(id, updatedCapacityBytes);
details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, String.valueOf(updatedCapacityBytes));
pool.setCapacityBytes(updatedCapacityBytes);
}
if (updatedCapacityIops != null) {
details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, updatedCapacityIops != null ? String.valueOf(updatedCapacityIops) : null);
_storagePoolDao.updateCapacityIops(id, updatedCapacityIops);
details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, String.valueOf(updatedCapacityIops));
pool.setCapacityIops(updatedCapacityIops);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why to set this value before making lifecycle call?
bcz updateStoragePool will receive same bytes.

}
if (cmd.getUrl() != null) {
details.put("url", cmd.getUrl());
}
_storagePoolDao.update(id, storagePool);
((PrimaryDataStoreLifeCycle)dataStoreLifeCycle).updateStoragePool(pool, details);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the implementation for other vendor, it should not be breaking change for other so that their DB update start failing.
Check the feasibility of try catch, if this logic breaks for other then add catch just to log the error and do not throw

_storagePoolDao.update(id, pool);
_storagePoolDao.updateDetails(id, details);
Comment on lines +1303 to 1305
}
}

return (PrimaryDataStoreInfo)_dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
}

Expand Down
Loading