Multi-Host support for NFS3 and iSCSI - #64
Conversation
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
45b634f to
8323d52
Compare
8323d52 to
1f0e3c1
Compare
1f0e3c1 to
8a26a59
Compare
There was a problem hiding this comment.
Pull request overview
Adds multi-host lifecycle handling for the ONTAP volume plugin by updating NFS export policy rules as hosts connect to / are removed from storage pools, and by extending the AccessGroup model/strategy API to support add/remove semantics.
Changes:
- Implemented
UnifiedNASStrategy.updateAccessGroupto add/remove host client matches in an existing NFS export policy. - Added
HostRuleActiontoAccessGroupand wired host-connect / host-removal flows to update NFS3 export policy rules. - Tightened/adjusted model and API surface (e.g.,
StorageStrategy.updateAccessGroupvisibility;ExportRule.ProtocolsEnumJSON annotations).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/StorageStrategyTest.java | Updates test scaffolding to match new abstract method visibility; import/method formatting adjustments. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedNASStrategy.java | Implements export-policy mutation logic for NFS host add/remove (multi-host enablement). |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java | Makes updateAccessGroup explicitly public abstract for consistent overriding/call sites. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/model/AccessGroup.java | Adds HostRuleAction (ADD/REMOVE) to drive update semantics. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/listener/OntapHostListener.java | Updates host lifecycle handling to update NFS3 export policy rules on connect and before removal. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java | Adjusts enum JSON serialization/deserialization behavior for export rule protocols. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java | Import reordering / formatting-only change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
8a26a59 to
f8a887c
Compare
8179fdb to
d1ed46a
Compare
| } | ||
|
|
||
| @Override | ||
| public boolean hostAboutToBeRemoved(long hostId) { |
There was a problem hiding this comment.
Thinking aloud, do we not have any usecase where this method returns false?
There was a problem hiding this comment.
If export policy rule hasn't been removed, we could catch the exception and return false
rajiv-jain-netapp
left a comment
There was a problem hiding this comment.
In the testing section, I need results for
- User created an NFS pool for cluster scope; validate the export policy on the ONTAP for the rules and client added.
- Now add a new host to this cluster and validate whether the export policy is getting updated for this new host or not.
- Similar to #2, test for host removal as well.
Note: I noticed the term "Live migrate" in your current test case capture. Just to remind you, we do not support live migration yet; these details will lead to a wrong interpretation in audiences. Please correct them accordingly.
Updated the Testing done with the relevant screenshots. |
Bring in CSTACKEX-158 (idempotent ONTAP snapshot delete) and multi-host NFS/iSCSI support (#64) on top of the apache/main sync.
This PR provides support to addition and removal of multiple hosts to NFS3 and iSCSI type storage pools <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> - [ ] 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) - [X] Major - [ ] Minor - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial **Only 1 Host present in the Cluster** <img width="1049" height="340" alt="Screenshot 2026-07-14 at 9 19 49 AM" src="https://github.com/user-attachments/assets/8d639c94-6686-40de-a362-341d41ff48fe" /> **Created an NFS3 StoragePool with Cluster scope** <img width="1049" height="340" alt="Screenshot 2026-07-14 at 9 20 58 AM" src="https://github.com/user-attachments/assets/f14cc903-bd60-47d4-8a7c-5a2ec4d2e0d0" /> **ONTAP volume created for the SP** <img width="1101" height="305" alt="Screenshot 2026-07-14 at 9 21 30 AM" src="https://github.com/user-attachments/assets/7823e398-782d-472d-948d-25153d5c372a" /> **Export Policy rule and client** <img width="1077" height="407" alt="Screenshot 2026-07-14 at 9 34 00 AM" src="https://github.com/user-attachments/assets/5426f9d4-cc96-45dc-9857-0312227867c8" /> **Added a new host** <img width="1048" height="314" alt="Screenshot 2026-07-14 at 9 24 42 AM" src="https://github.com/user-attachments/assets/5acd2a38-6b54-4393-a4f9-86790f1c81de" /> **Updated client in the Export Policy** <img width="1077" height="407" alt="Screenshot 2026-07-14 at 9 35 24 AM" src="https://github.com/user-attachments/assets/7d0e8470-3391-4909-9de9-a3f22fead439" /> **Removed the host from the cluster** <img width="1042" height="342" alt="Screenshot 2026-07-14 at 9 32 16 AM" src="https://github.com/user-attachments/assets/24fea619-4c8b-4805-ad53-49fc2fb6aa13" /> **The respective client has been removed from the Export Policy** <img width="1077" height="423" alt="Screenshot 2026-07-14 at 9 36 07 AM" src="https://github.com/user-attachments/assets/76e62a97-a034-4c75-8642-41bd116938e1" /> Test Done | Result | Comments -- | -- | -- Create an instance by specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance specifying host and disk offering pointed to iSCSI Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to iSCSI Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance by specifying the host and disk offering pointed to 2 NFS3 Primary Storage Pools (Cluster scoped + Zone scoped) | FAIL | StoragePoolAllocator is coming as empty and the random strategy to allocate was failing. Create an instance by specifying the host and disk offering pointed to 2 iSCSI Primary Storage Pools (Cluster scoped + Zone scoped) | FAIL | StoragePoolAllocator is coming as empty and the random strategy to allocate was failing. Create an instance by specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Create an instance specifying host and disk offering pointed to iSCSI Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to iSCSI Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Power off VM on Host-1 and start it on Host-2 (same cluster) with disk offering pointed to NFS3 primary storage pool (cluster scoped) | PASS | Power off and on a VM with 'last known host' selected. Create the instance in a cluster, without specifying a host. | PASS | Last known host was selected Power off and on a VM with 'last known host' NOT selected. Create the instance in a cluster, without specifying a host. | PASS | VM got hosted on the chosen host. Power off and on a VM with 'last known host' selected but choose a different host. Create the instance in a cluster, without specifying a host. | PASS | VM got hosted on the chosen host. Insufficient resources in the storage pool. Instance creation should fail. | PASS | Generic error is being displayed instead of proper error regarding Insufficient resources. One host in the cluster (min. 2 hosts) loaded, resulting in insufficient CPU. Disk Offering pointed to Cluster scoped primary storage pool. | PASS | Both host in the cluster (min. 2 hosts) loaded, resulting in insufficient CPU. Disk Offering pointed to Cluster scoped primary storage pool. Instance creation should fail but disks should first get created and then destroyed.
This PR provides support to addition and removal of multiple hosts to NFS3 and iSCSI type storage pools <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> - [ ] 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) - [X] Major - [ ] Minor - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial **Only 1 Host present in the Cluster** <img width="1049" height="340" alt="Screenshot 2026-07-14 at 9 19 49 AM" src="https://github.com/user-attachments/assets/8d639c94-6686-40de-a362-341d41ff48fe" /> **Created an NFS3 StoragePool with Cluster scope** <img width="1049" height="340" alt="Screenshot 2026-07-14 at 9 20 58 AM" src="https://github.com/user-attachments/assets/f14cc903-bd60-47d4-8a7c-5a2ec4d2e0d0" /> **ONTAP volume created for the SP** <img width="1101" height="305" alt="Screenshot 2026-07-14 at 9 21 30 AM" src="https://github.com/user-attachments/assets/7823e398-782d-472d-948d-25153d5c372a" /> **Export Policy rule and client** <img width="1077" height="407" alt="Screenshot 2026-07-14 at 9 34 00 AM" src="https://github.com/user-attachments/assets/5426f9d4-cc96-45dc-9857-0312227867c8" /> **Added a new host** <img width="1048" height="314" alt="Screenshot 2026-07-14 at 9 24 42 AM" src="https://github.com/user-attachments/assets/5acd2a38-6b54-4393-a4f9-86790f1c81de" /> **Updated client in the Export Policy** <img width="1077" height="407" alt="Screenshot 2026-07-14 at 9 35 24 AM" src="https://github.com/user-attachments/assets/7d0e8470-3391-4909-9de9-a3f22fead439" /> **Removed the host from the cluster** <img width="1042" height="342" alt="Screenshot 2026-07-14 at 9 32 16 AM" src="https://github.com/user-attachments/assets/24fea619-4c8b-4805-ad53-49fc2fb6aa13" /> **The respective client has been removed from the Export Policy** <img width="1077" height="423" alt="Screenshot 2026-07-14 at 9 36 07 AM" src="https://github.com/user-attachments/assets/76e62a97-a034-4c75-8642-41bd116938e1" /> Test Done | Result | Comments -- | -- | -- Create an instance by specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance specifying host and disk offering pointed to iSCSI Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to iSCSI Primary Storage Pool (Cluster scoped with min of 2 hosts) | PASS | Create an instance by specifying the host and disk offering pointed to 2 NFS3 Primary Storage Pools (Cluster scoped + Zone scoped) | FAIL | StoragePoolAllocator is coming as empty and the random strategy to allocate was failing. Create an instance by specifying the host and disk offering pointed to 2 iSCSI Primary Storage Pools (Cluster scoped + Zone scoped) | FAIL | StoragePoolAllocator is coming as empty and the random strategy to allocate was failing. Create an instance by specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Create an instance specifying host and disk offering pointed to iSCSI Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to NFS3 Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Create an instance in a cluster with atleast 2 hosts in the cluster by not specifying the host and disk offering pointed to iSCSI Primary Storage Pool (Zone scoped with min of 2 hosts) | FAIL | Zone scoped instance creation failing (CSTACKEX-188) Power off VM on Host-1 and start it on Host-2 (same cluster) with disk offering pointed to NFS3 primary storage pool (cluster scoped) | PASS | Power off and on a VM with 'last known host' selected. Create the instance in a cluster, without specifying a host. | PASS | Last known host was selected Power off and on a VM with 'last known host' NOT selected. Create the instance in a cluster, without specifying a host. | PASS | VM got hosted on the chosen host. Power off and on a VM with 'last known host' selected but choose a different host. Create the instance in a cluster, without specifying a host. | PASS | VM got hosted on the chosen host. Insufficient resources in the storage pool. Instance creation should fail. | PASS | Generic error is being displayed instead of proper error regarding Insufficient resources. One host in the cluster (min. 2 hosts) loaded, resulting in insufficient CPU. Disk Offering pointed to Cluster scoped primary storage pool. | PASS | Both host in the cluster (min. 2 hosts) loaded, resulting in insufficient CPU. Disk Offering pointed to Cluster scoped primary storage pool. Instance creation should fail but disks should first get created and then destroyed.
Description
This PR...
Provides support to Multi-Host for NFS3 and iSCSI
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Only 1 Host present in the Cluster

Created an NFS3 StoragePool with Cluster scope

ONTAP volume created for the SP

Export Policy rule and client

Added a new host

Updated client in the Export Policy

Removed the host from the cluster

The respective client has been removed from the Export Policy
