CSTACKEX-261: enabling cloudstack volume resize (GROW) for iscsi and nfs - #100
sathvikaragi wants to merge 1 commit into
Conversation
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 24.71% |
| Branch coverage | 18.85% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |
| 🟡 B | 60-79% | Good - almost there, don't stop now 😉 |
| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |
| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |
| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
| } | ||
|
|
||
| public Volume getStorageVolume(String uuid) { | ||
| logger.info("getStorageVolume: Fetching ONTAP volume by UUID: {}", uuid); |
There was a problem hiding this comment.
Better to have null check for UUID field
| CloudStackVolume cloudStackVolume = new CloudStackVolume(); | ||
| cloudStackVolume.setVolumeInfo(volumeInfo); | ||
|
|
||
| if (ProtocolType.ISCSI.name().equals(details.get(OntapStorageConstants.PROTOCOL))) { |
| public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) { | ||
| CreateCmdResult result = null; | ||
| try { | ||
| VolumeInfo volumeInfo = (VolumeInfo) data; |
There was a problem hiding this comment.
Have a data type check here before type casting it to a specific type.
| CreateCmdResult result = null; | ||
| try { | ||
| VolumeInfo volumeInfo = (VolumeInfo) data; | ||
| ResizeVolumePayload payload = (ResizeVolumePayload) volumeInfo.getpayload(); |
| volumeVO.setSize(payload.newSize); | ||
| volumeDao.update(volumeVO.getId(), volumeVO); | ||
|
|
||
| result = new CreateCmdResult(null, new Answer(null, true, null)); |
There was a problem hiding this comment.
dont we need to pass path back as part of CreateCmdResult ? Also I think we should pass the exact type of Command as part of Answer
There was a problem hiding this comment.
it is getting set in finally block below
| Map<String, String> poolDetails = storagePoolDetailsDao.listDetailsKeyPairs(storagePool.getId()); | ||
| String flexVolUuid = poolDetails != null ? poolDetails.get(OntapStorageConstants.VOLUME_UUID) : null; | ||
|
|
||
| if (StringUtils.isBlank(flexVolUuid)) { |
There was a problem hiding this comment.
lets discuss on this today-> Lets say we somehow miss to update the details map for flexvol uuid, should not we instead of no/op , have a secondary code (making live ontap call to by storage pool name) ?
| volume.getSize(), sizeInBytes, false, null); | ||
| // instanceName is set by VolumeApiServiceImpl.orchestrateResizeVolume() before calling the | ||
| // driver — it is the VM instance name when attached, or "none" when the volume is detached. | ||
| ResizeVolumePayload resizePayload = volumeObject.getpayload() instanceof ResizeVolumePayload |
There was a problem hiding this comment.
isn't this already been taken care at ontap driver class ?
| volumeVO.setSize(payload.newSize); | ||
| volumeDao.update(volumeVO.getId(), volumeVO); | ||
|
|
||
| result = new CreateCmdResult(null, new Answer(null, true, null)); |
There was a problem hiding this comment.
it is getting set in finally block below
| CloudStackVolume cloudStackVolume = new CloudStackVolume(); | ||
| cloudStackVolume.setVolumeInfo(volumeInfo); | ||
|
|
||
| if (ProtocolType.ISCSI.name().equals(details.get(OntapStorageConstants.PROTOCOL))) { |
There was a problem hiding this comment.
can this protocol specific code go to strategy based impl?
Description
Cloudstack volume resize supports grow for both NFS and Iscsi which on ontap leads to increase in size for a LUN in case of iscsi and file in case of NFS.Also consists of UT's for the changes and implementation for getusedbytes which is called in this flow to check if storagepool has enough space.
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?