Skip to content

Multi-Host support for NFS3 and iSCSI#64

Open
sandeeplocharla wants to merge 10 commits into
mainfrom
feature/CSTACKEX-192
Open

Multi-Host support for NFS3 and iSCSI#64
sandeeplocharla wants to merge 10 commits into
mainfrom
feature/CSTACKEX-192

Conversation

@sandeeplocharla

@sandeeplocharla sandeeplocharla commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR...
Provides support to Multi-Host for NFS3 and iSCSI

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?

Only 1 Host present in the Cluster
Screenshot 2026-07-14 at 9 19 49 AM

Created an NFS3 StoragePool with Cluster scope
Screenshot 2026-07-14 at 9 20 58 AM

ONTAP volume created for the SP
Screenshot 2026-07-14 at 9 21 30 AM

Export Policy rule and client
Screenshot 2026-07-14 at 9 34 00 AM

Added a new host
Screenshot 2026-07-14 at 9 24 42 AM

Updated client in the Export Policy
Screenshot 2026-07-14 at 9 35 24 AM

Removed the host from the cluster
Screenshot 2026-07-14 at 9 32 16 AM

The respective client has been removed from the Export Policy
Screenshot 2026-07-14 at 9 36 07 AM

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.

@github-actions

Copy link
Copy Markdown

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

Copilot AI review requested due to automatic review settings July 8, 2026 05:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.updateAccessGroup to add/remove host client matches in an existing NFS export policy.
  • Added HostRuleAction to AccessGroup and wired host-connect / host-removal flows to update NFS3 export policy rules.
  • Tightened/adjusted model and API surface (e.g., StorageStrategy.updateAccessGroup visibility; ExportRule.ProtocolsEnum JSON 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.

@github-actions

Copy link
Copy Markdown

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

Copilot AI review requested due to automatic review settings July 10, 2026 06:13

Copilot AI left a comment

Copy link
Copy Markdown

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 17 out of 17 changed files in this pull request and generated 4 comments.

Copilot AI review requested due to automatic review settings July 10, 2026 06:40

Copilot AI left a comment

Copy link
Copy Markdown

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 6 out of 7 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings July 13, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown

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 7 out of 7 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 13, 2026 10:09

Copilot AI left a comment

Copy link
Copy Markdown

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 7 out of 7 changed files in this pull request and generated 2 comments.

}

@Override
public boolean hostAboutToBeRemoved(long hostId) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thinking aloud, do we not have any usecase where this method returns false?

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.

If export policy rule hasn't been removed, we could catch the exception and return false

"Cannot update an export policy with no existing rules.");
}

// This plugin creates a single NFS export rule per policy. More than one rule means the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is not true for export policy, right? we have one export policy per pool?

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.

As its an update method, the code is checking to see if atleast one rule exists. But, its not creating one policy per host, though its over doing the check currently. Will correct it as we plan to allow pool creation with empty rules set.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Okay, check the code in the remove block for the last client entry in that rule. If that is the case, we have to remove the rule itself rather than remove the client from the rule. Validate the values from ONTAP while testing.

Copilot AI review requested due to automatic review settings July 13, 2026 16:57

Copilot AI left a comment

Copy link
Copy Markdown

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 7 out of 7 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings July 14, 2026 02:59

Copilot AI left a comment

Copy link
Copy Markdown

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 7 out of 7 changed files in this pull request and generated 3 comments.

@rajiv-jain-netapp rajiv-jain-netapp left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the testing section, I need results for

  1. User created an NFS pool for cluster scope; validate the export policy on the ONTAP for the rules and client added.
  2. Now add a new host to this cluster and validate whether the export policy is getting updated for this new host or not.
  3. 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.

@sandeeplocharla

Copy link
Copy Markdown
Collaborator Author

In the testing section, I need results for

  1. User created an NFS pool for cluster scope; validate the export policy on the ONTAP for the rules and client added.
  2. Now add a new host to this cluster and validate whether the export policy is getting updated for this new host or not.
  3. Similar to Feignconfiguration and volume feignClient along with desired POJOs #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.
Also, the test section mentions "Live migrate a VM between two hosts in the same cluster". As per my understanding, we currently don't support VM's storage migration i.e., between 2 storage pools, which the test case is not claiming to be. If the language could be made better, please suggest an alternative, will update it accordingly.

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.

3 participants