Skip to content

Netapp ONTAP bugfixes for 4.23.0#13578

Open
piyush5netapp wants to merge 5 commits into
apache:mainfrom
NetApp:NetappOntapbugfixes4.23.0
Open

Netapp ONTAP bugfixes for 4.23.0#13578
piyush5netapp wants to merge 5 commits into
apache:mainfrom
NetApp:NetappOntapbugfixes4.23.0

Conversation

@piyush5netapp

@piyush5netapp piyush5netapp commented Jul 9, 2026

Copy link
Copy Markdown

Description

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?

piyush5netapp and others added 3 commits July 9, 2026 21:29
### Description

This PR...
<!--- Describe your changes in DETAIL - And how has behaviour
functionally changed. -->

<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to
reproduce. -->

<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically
be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->

<!---
*******************************************************************************
-->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE
DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!---
*******************************************************************************
-->

### Types of changes

- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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):
<img width="1215" height="117" alt="image"
src="https://github.com/user-attachments/assets/0a677980-140d-4904-b196-5a732586a222"
/>
<img width="1228" height="393" alt="image"
src="https://github.com/user-attachments/assets/d5715e87-88d0-4e6e-85e9-2c4b913dfa5f"
/>


### How Has This Been Tested?

<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran
to -->

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

<!-- see how your change affects other areas of the code, etc. -->

<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
document -->

---------

Co-authored-by: Srivastava, Piyush <Piyush.Srivastava@netapp.com>
#65)

### Description

This PR...
CSTACKEX-176: Storage Pool Backend by ONTAP FlexVolume is not Thin
Provisioned
CSTACKEX-172: VM create failure due to aggrs not available and UI says
"Unable to orchestrate the start of VM instance"
CSTACKEX-199: Error message when cluster password is wrong while
creating primary storage pool is not user intuitive
CSTACKEX-181: Multiple host with same hostname will not follow per host
igroup design

### Types of changes

- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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):
<img width="1125" height="861" alt="Screenshot 2026-06-18 at 2 33 52 PM"
src="https://github.com/user-attachments/assets/e2f5bc20-0109-4b5a-a720-dbd3d39ee254"
/>

<img width="679" height="280" alt="image"
src="https://github.com/user-attachments/assets/b7dac4f1-1a6b-4234-bcd5-47c5efe8f798"
/>



### How Has This Been Tested?

1- Create a storage pool with invalid ontap cred - throw the error
2- Create a storage pool with valid ontap cred - success
3- Verify Ontap Volume - thin provisioned
4- VM instance VM1 creation - suceess and igroup created with
cs_svmName_hostUUID
5- VM instance VM2 creation - reused the same igroup
6- VM instance VM1 and VM2 delete - igroup also got deleted

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

<!-- see how your change affects other areas of the code, etc. -->

<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
document -->

---------

Co-authored-by: Gupta, Surya <Surya.Gupta@netapp.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR delivers targeted NetApp ONTAP (Unified) primary storage bugfixes and related test coverage improvements, addressing correctness issues in iSCSI host access-group naming, connection validation behavior, and attach-time volume metadata consistency.

Changes:

  • Reloads the volume from the DB after grantAccess() during volume attach to avoid using stale managed-storage metadata (e.g., ONTAP-updated path/iSCSI name).
  • Updates ONTAP iGroup naming to use host UUIDs, sanitize invalid characters, and enforce the ONTAP 96-character limit (with new unit tests).
  • Refines ONTAP connect() validation to focus on connectivity/SVM/aggregate state (not pool-capacity comparisons), adds clearer auth failures, enforces KVM-only attach in the ONTAP datastore lifecycle, and sets thin-provisioning guarantee on FlexVolume create.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Reloads volume after grantAccess() during attach to pick up driver-updated fields.
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageUtils.java Switches iGroup naming to host UUID, sanitizes, and truncates to ONTAP limits.
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageConstants.java Adds iGroup max-length constant (96).
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedSANStrategy.java Uses host UUID for iGroup naming for create/delete access group paths.
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java Uses host UUID for iGroup naming in grant/revoke access.
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java Adjusts connect() aggregate selection logic, improves auth error handling, and sets FlexVolume guarantee to NONE.
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java Enforces KVM-only attachZone and persists pool hypervisor type before host connections.
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java Adds JSON model support for guarantee to drive FlexVolume provisioning mode.
plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/utils/OntapStorageUtilsTest.java New tests for iGroup naming (sanitization and max-length enforcement).
plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/UnifiedSANStrategyTest.java Updates host mocks to provide UUIDs for iGroup naming.
plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/StorageStrategyTest.java Adds regression tests for connect() behavior and invalid credentials handling.
plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycleTest.java Expands lifecycle tests, including KVM-only attachZone validation.
plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriverTest.java Updates host mocks to provide UUIDs used by iGroup naming paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
Comment on lines +142 to 151
public static String getIgroupName(String svmName, String hostUuid) {
//Igroup name format: cs_svmName_hostUuid
String sanitizedHostUuid = hostUuid.replaceAll("[^a-zA-Z0-9_-]", "_");
String igroupName = OntapStorageConstants.CS + OntapStorageConstants.UNDERSCORE + svmName + OntapStorageConstants.UNDERSCORE + sanitizedHostUuid;
// ONTAP igroup names are limited to 96 characters; truncate if longer.
if (igroupName.length() > OntapStorageConstants.IGROUP_NAME_MAX_LENGTH) {
igroupName = igroupName.substring(0, OntapStorageConstants.IGROUP_NAME_MAX_LENGTH);
}
return igroupName;
}
@winterhazel winterhazel added this to the 4.23.0 milestone Jul 9, 2026
@winterhazel winterhazel self-requested a review July 9, 2026 16:20

@winterhazel winterhazel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@piyush5netapp I left some reviews. Also, could you include the suggestion in #13053 (comment) here?

Comment on lines +344 to +346
storagePool.setHypervisor(hypervisorType);
storagePoolDao.update(storagePool.getId(),storagePool);
logger.debug("attachZone : Set Hypervisor type for storage pool {} to {}", storagePool.getName(), hypervisorType);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
storagePool.setHypervisor(hypervisorType);
storagePoolDao.update(storagePool.getId(),storagePool);
logger.debug("attachZone : Set Hypervisor type for storage pool {} to {}", storagePool.getName(), hypervisorType);

You can pass hypervisorType as a second parameter of _dataStoreHelper.attachZone at the end of this method.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

volumeRequest.setAggregates(List.of(aggr));
volumeRequest.setSize(size);
volumeRequest.setNas(nas);
volumeRequest.setGuarantee(new Volume.Guarantee(Volume.Guarantee.TypeEnum.NONE));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Out of curiosity, is thick provisioning support planned for the future?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, thick provisioning is one of the future support we are aiming for but for now we have defaulted it to thin. In future, that will become a user input of choosing between these options.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A bit of a corner case, but does it make sense to change this to availableBytes < size? The way it is now, aggregates that have exactly the requested size are skipped.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated in latest.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.53425% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.47%. Comparing base (33c3967) to head (e377eff).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
.../apache/cloudstack/storage/feign/model/Volume.java 33.33% 24 Missing ⚠️
...he/cloudstack/storage/service/StorageStrategy.java 68.42% 6 Missing ⚠️
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13578   +/-   ##
=========================================
  Coverage     19.46%   19.47%           
- Complexity    19237    19247   +10     
=========================================
  Files          6288     6288           
  Lines        565692   565746   +54     
  Branches      69079    69082    +3     
=========================================
+ Hits         110132   110186   +54     
- Misses       443595   443599    +4     
+ Partials      11965    11961    -4     
Flag Coverage Δ
uitests 3.46% <ø> (ø)
unittests 20.73% <57.53%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@piyush5netapp

piyush5netapp commented Jul 10, 2026

Copy link
Copy Markdown
Author

@piyush5netapp I left some reviews. Also, could you include the suggestion in #13053 (comment) here?

Yes, I have raised an internal PR with my team(waiting for approval). Will update in next commit. Also, I think I should also add a similar "Netapp ONTAP" provider check in VolumeApiServiceImpl.createVolumeOnPrimaryForAttachIfNeeded same as we did in VolumeServiceImpl . What do you think so?

piyush5netapp and others added 2 commits July 10, 2026 19:31
…emplate flow (#75)

### Description

This PR...
<!--- Describe your changes in DETAIL - And how has behaviour
functionally changed. -->

<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to
reproduce. -->

<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically
be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->

<!---
*******************************************************************************
-->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE
DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!---
*******************************************************************************
-->

### 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)
- [x] 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):
<img width="2456" height="786" alt="image"
src="https://github.com/user-attachments/assets/8081aee8-10ba-4ffc-b00f-c3b4112869cc"
/>


### How Has This Been Tested?

<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran
to -->

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

<!-- see how your change affects other areas of the code, etc. -->

<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
document -->

Co-authored-by: Srivastava, Piyush <Piyush.Srivastava@netapp.com>
### Description

This PR...
<!--- Describe your changes in DETAIL - And how has behaviour
functionally changed. -->

<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to
reproduce. -->

<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically
be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->

<!---
*******************************************************************************
-->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE
DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!---
*******************************************************************************
-->

### 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):
Storage pool
<img width="1240" height="439" alt="image"
src="https://github.com/user-attachments/assets/cfc7bfdc-9807-470c-b043-ff1905acd0d0"
/>
VM instance
<img width="1230" height="353" alt="image"
src="https://github.com/user-attachments/assets/e8bf157d-105a-4c85-8452-9c391c467778"
/>
ONTAP flexvol
<img width="1261" height="241" alt="image"
src="https://github.com/user-attachments/assets/f7159199-a26a-4147-a41f-44524fe7ca8e"
/>
ONTAP Luns
<img width="1267" height="207" alt="image"
src="https://github.com/user-attachments/assets/a3645d25-d7b3-412c-bed7-2c43d6a0e6b8"
/>
ONTAP Igroup
<img width="1254" height="630" alt="image"
src="https://github.com/user-attachments/assets/1af9953a-d761-4b53-884d-e7c9f7ba8b6f"
/>


### How Has This Been Tested?

<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran
to -->

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

<!-- see how your change affects other areas of the code, etc. -->

<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
document -->

---------

Co-authored-by: Srivastava, Piyush <Piyush.Srivastava@netapp.com>
Copilot AI review requested due to automatic review settings July 10, 2026 14:03
@piyush5netapp

Copy link
Copy Markdown
Author

@winterhazel I have pushed some changes which resolves all of your comment. Please re-review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment on lines +5100 to +5102
if(DataStoreProvider.ONTAP_PLUGIN_NAME.equals(volumeToAttachStoragePool.getStorageProviderName())){
volumeToAttach = _volsDao.findById(volumeToAttach.getId());
}
Comment on lines +1367 to +1371
if (DataStoreProvider.ONTAP_PLUGIN_NAME.equals(primaryDataStore.getStorageProviderName())) {
// For Netapp ONTAP iscsiName or Lun path is available only after grantAccess
volumeInfo = volFactory.getVolume(volumeInfo.getId(), primaryDataStore);
String managedStoreTarget = ObjectUtils.defaultIfNull(volumeInfo.get_iScsiName(), volumeInfo.getUuid());
details.put(PrimaryDataStore.MANAGED_STORE_TARGET, managedStoreTarget);
@weizhouapache

Copy link
Copy Markdown
Member

@piyush5netapp

I got two issues with the plugin

  • the unit tests are always run even if -DskipTests flag is passed.

can you please remove skiptTests in pom.xml ?

# grep skipTests plugins/storage/volume/ontap/pom.xml 
                    <skipTests>false</skipTests>
  • there are a lot of test failures when build the plugin with openjdk 21
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 mvn -T8 -P developer,systemvm clean install -Dnoredist -pl plugins/storage/volume/ontap/

no issues when build with openjdk 17.

could you please check ? the issue seems related to mockito versions which are too old.

        <mockito.version>3.12.4</mockito.version>
        <mockito-junit-jupiter.version>5.2.0</mockito-junit-jupiter.version>

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants