Netapp ONTAP bugfixes for 4.23.0#13578
Conversation
### 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>
There was a problem hiding this comment.
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.
| 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
left a comment
There was a problem hiding this comment.
@piyush5netapp I left some reviews. Also, could you include the suggestion in #13053 (comment) here?
| storagePool.setHypervisor(hypervisorType); | ||
| storagePoolDao.update(storagePool.getId(),storagePool); | ||
| logger.debug("attachZone : Set Hypervisor type for storage pool {} to {}", storagePool.getName(), hypervisorType); |
There was a problem hiding this comment.
| 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.
| volumeRequest.setAggregates(List.of(aggr)); | ||
| volumeRequest.setSize(size); | ||
| volumeRequest.setNas(nas); | ||
| volumeRequest.setGuarantee(new Volume.Guarantee(Volume.Guarantee.TypeEnum.NONE)); |
There was a problem hiding this comment.
Out of curiosity, is thick provisioning support planned for the future?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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? |
…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>
|
@winterhazel I have pushed some changes which resolves all of your comment. Please re-review. |
| if(DataStoreProvider.ONTAP_PLUGIN_NAME.equals(volumeToAttachStoragePool.getStorageProviderName())){ | ||
| volumeToAttach = _volsDao.findById(volumeToAttach.getId()); | ||
| } |
| 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); |
|
I got two issues with the plugin
can you please remove
no issues when build with openjdk 17. could you please check ? the issue seems related to mockito versions which are too old. |
Description
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?