Skip to content

CSTACKEX-261: enabling cloudstack volume resize (GROW) for iscsi and nfs - #100

Open
sathvikaragi wants to merge 1 commit into
mainfrom
feature/CSTACKEX-261
Open

sathvikaragi wants to merge 1 commit into
mainfrom
feature/CSTACKEX-261

Conversation

@sathvikaragi

Copy link
Copy Markdown
Collaborator

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

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Better to have null check for UUID field

CloudStackVolume cloudStackVolume = new CloudStackVolume();
cloudStackVolume.setVolumeInfo(volumeInfo);

if (ProtocolType.ISCSI.name().equals(details.get(OntapStorageConstants.PROTOCOL))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

use isISCSI() method instead

public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
CreateCmdResult result = null;
try {
VolumeInfo volumeInfo = (VolumeInfo) data;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

same here if applicable

volumeVO.setSize(payload.newSize);
volumeDao.update(volumeVO.getId(), volumeVO);

result = new CreateCmdResult(null, new Answer(null, true, null));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

it is getting set in finally block below

CloudStackVolume cloudStackVolume = new CloudStackVolume();
cloudStackVolume.setVolumeInfo(volumeInfo);

if (ProtocolType.ISCSI.name().equals(details.get(OntapStorageConstants.PROTOCOL))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can this protocol specific code go to strategy based impl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants