Skip to content

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

Open
sathvikaragi wants to merge 22 commits into
mainfrom
feature/CSTACKEX-261
Open

sathvikaragi wants to merge 22 commits into
mainfrom
feature/CSTACKEX-261

Conversation

@sathvikaragi

@sathvikaragi sathvikaragi commented Sep 15, 2026 •

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?

Before resizing volumes:
Screenshot 2026-09-24 at 3 25 10 PM

Growing iscsi csvolume to 10GiB:
Screenshot 2026-09-24 at 3 32 37 PM

Lun on Ontap is grown to 10GiB:
Screenshot 2026-09-24 at 3 30 02 PM

Growing Nfs volume to 10GiB:
Screenshot 2026-09-24 at 3 34 16 PM

virtual size of file on host side grown to 10GiB:
Screenshot 2026-09-24 at 3 34 45 PM

maxsize by default is 1024 GiB in cloudstack for volume which is configurable if size greater than that throws an error:
Screenshot 2026-09-24 at 3 37 08 PM

considering the overprovisiong factor, used space and current space, cloud stack calculates and propagates error in case value is over that: here get used bytes gets triggered:
ISCSI CS-volume resize and get usedbytes here is triggered.
Screenshot 2026-09-28 at 5 47 46 PM

NFS CS-volume resize and get usedbytes here is triggered.
Screenshot 2026-09-28 at 5 49 24 PM

Screenshot 2026-09-24 at 3 38 41 PM

when Lun is deleted on ontap and cs volume is tried to resize , error is thrown:
Screenshot 2026-09-24 at 3 40 17 PM

when file is deleted on ONtap and resize is performed on volume:
Screenshot 2026-09-24 at 3 41 40 PM

when shrink is performed on Iscsi volume with shrinkOk as true:
Screenshot 2026-09-24 at 3 42 59 PM

when shrink is performed on NFS volume :
Screenshot 2026-09-24 at 3 43 56 PM

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

@piyush5netapp piyush5netapp added the to-be-cherry-picked-for-upstream This PR needs to be cherry picked for next upstream PR label Sep 22, 2026
@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.75%
Branch coverage 18.89%

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

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.76%
Branch coverage 18.89%

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

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.77%
Branch coverage 18.90%

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


logger.debug("getUsedBytes: FlexVolume [{}] backing pool [{}] reports {} bytes used",
flexVolUuid, storagePool.getId(), flexVol.getSpace().getUsed());
return flexVol.getSpace().getUsed();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

check the return type of getUsed and have the validation

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@JsonInclude(NON_NULL) only excludes null fields when sending JSON. if used is omitted or null during deserialization, primitive long defaults to 0.

// Resolve LUN UUID from volume details when not pre-populated on the cloudstackVolume
if (cloudstackVolume.getLun() == null || cloudstackVolume.getLun().getUuid() == null) {
long volumeId = cloudstackVolume.getVolumeInfo().getId();
VolumeDetailVO lunUuidDetail = volumeDetailsDao.findDetail(volumeId, OntapStorageConstants.LUN_DOT_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.

check findDetails by key is present or not,
if yes then replace this method call

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Here we are fetching the details by the key LUN UUID only

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.76%
Branch coverage 18.90%

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

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.76%
Branch coverage 18.90%

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

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.75%
Branch coverage 18.89%

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

@sandeeplocharla sandeeplocharla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm good with the rest of the code

logger.error("resizeCloudStackVolume: Lun resize failed. Invalid request: {}", cloudstackVolume);
throw new CloudRuntimeException("Failed to resize Lun, invalid request");
}
if (sizeInBytes <= 0) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This check should be at the UI level.
As shrink is not supported, this check could rather be 'sizeInBytes <= currentSizeInBytes'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

in case of shrink we throw an error in driver before even sanstrategy is called hence no need to add it here. This below part of code is there in driver already.
if (payload.newSize < volumeVO.getSize()) {
throw new CloudRuntimeException("Unable to shrink volume.");
}
This check was added as a part of template cache PR when resize is triggered as a part of VM creation with root disk size inputted greater than template it tries to resize. In that flow he wanted to check for positive input validation.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.79%
Branch coverage 18.94%

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

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.84%
Branch coverage 19.00%

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

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

Labels

to-be-cherry-picked-for-upstream This PR needs to be cherry picked for next upstream PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants