Skip to content

Commit 2b6cb6f

Browse files
committed
CSTACKEX-241: adding in the updatestoragepool of provider's lifecycle
1 parent 065269a commit 2b6cb6f

1 file changed

Lines changed: 22 additions & 24 deletions

File tree

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

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,30 +1285,28 @@ public PrimaryDataStoreInfo updateStoragePool(UpdateStoragePoolCmd cmd) throws I
12851285
changes = true;
12861286
}
12871287

1288-
if (changes) {
1289-
StoragePoolVO storagePool = _storagePoolDao.findById(id);
1290-
DataStoreProvider dataStoreProvider = _dataStoreProviderMgr.getDataStoreProvider(storagePool.getStorageProviderName());
1291-
DataStoreLifeCycle dataStoreLifeCycle = dataStoreProvider.getDataStoreLifeCycle();
1292-
1293-
if (dataStoreLifeCycle instanceof PrimaryDataStoreLifeCycle) {
1294-
if (updatedCapacityBytes != null) {
1295-
details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, updatedCapacityBytes != null ? String.valueOf(updatedCapacityBytes) : null);
1296-
_storagePoolDao.updateCapacityBytes(id, updatedCapacityBytes);
1297-
}
1298-
if (updatedCapacityIops != null) {
1299-
details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, updatedCapacityIops != null ? String.valueOf(updatedCapacityIops) : null);
1300-
_storagePoolDao.updateCapacityIops(id, updatedCapacityIops);
1301-
}
1302-
if (cmd.getUrl() != null) {
1303-
details.put("url", cmd.getUrl());
1304-
}
1305-
_storagePoolDao.update(id, storagePool);
1306-
_storagePoolDao.updateDetails(id, details);
1307-
}
1308-
}
1309-
1310-
return (PrimaryDataStoreInfo)_dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
1311-
}
1288+
if (changes) {
1289+
DataStoreProvider dataStoreProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
1290+
DataStoreLifeCycle dataStoreLifeCycle = dataStoreProvider.getDataStoreLifeCycle();
1291+
if (dataStoreLifeCycle instanceof PrimaryDataStoreLifeCycle) {
1292+
if (updatedCapacityBytes != null) {
1293+
details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, String.valueOf(updatedCapacityBytes));
1294+
pool.setCapacityBytes(updatedCapacityBytes);
1295+
}
1296+
if (updatedCapacityIops != null) {
1297+
details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, String.valueOf(updatedCapacityIops));
1298+
pool.setCapacityIops(updatedCapacityIops);
1299+
}
1300+
if (cmd.getUrl() != null) {
1301+
details.put("url", cmd.getUrl());
1302+
}
1303+
((PrimaryDataStoreLifeCycle)dataStoreLifeCycle).updateStoragePool(pool, details);
1304+
_storagePoolDao.update(id, pool);
1305+
_storagePoolDao.updateDetails(id, details);
1306+
}
1307+
}
1308+
return (PrimaryDataStoreInfo)_dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
1309+
}
13121310

13131311
private void changeStoragePoolScopeToZone(StoragePoolVO primaryStorage) {
13141312
/*

0 commit comments

Comments
 (0)