CSTACKEX-241: adding in the updatestoragepool of provider's lifecycle - #90
CSTACKEX-241: adding in the updatestoragepool of provider's lifecycle#90sathvikaragi wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates CloudStack’s updateStoragePool flow to invoke the storage provider lifecycle (PrimaryDataStoreLifeCycle.updateStoragePool) so plugins are notified when a primary storage pool is updated (e.g., during resize via capacityBytes/capacityIops).
Changes:
- Calls
PrimaryDataStoreLifeCycle.updateStoragePool(pool, details)duringStorageManagerImpl.updateStoragePool. - Propagates updated capacity values into the in-memory
StoragePoolVObefore persisting. - Persists merged storage pool details after invoking the lifecycle update.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (changes) { | ||
| DataStoreProvider dataStoreProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName()); | ||
| DataStoreLifeCycle dataStoreLifeCycle = dataStoreProvider.getDataStoreLifeCycle(); | ||
| if (dataStoreLifeCycle instanceof PrimaryDataStoreLifeCycle) { | ||
| if (updatedCapacityBytes != null) { |
| ((PrimaryDataStoreLifeCycle)dataStoreLifeCycle).updateStoragePool(pool, details); | ||
| _storagePoolDao.update(id, pool); | ||
| _storagePoolDao.updateDetails(id, details); |
| ((PrimaryDataStoreLifeCycle)dataStoreLifeCycle).updateStoragePool(pool, details); | ||
| _storagePoolDao.update(id, pool); | ||
| _storagePoolDao.updateDetails(id, details); |
| details.put("url", cmd.getUrl()); | ||
| } | ||
| _storagePoolDao.update(id, storagePool); | ||
| ((PrimaryDataStoreLifeCycle)dataStoreLifeCycle).updateStoragePool(pool, details); |
There was a problem hiding this comment.
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
| 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); |
There was a problem hiding this comment.
why to set this value before making lifecycle call?
bcz updateStoragePool will receive same bytes.
Description
While implementing storage pool resize via the updateStoragePool API,
StorageManagerImpl.updateStoragePool()updates the database but never calls PrimaryDataStoreLifeCycle.updateStoragePool() on the storage plugin.
adding that call in here.
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?