Feature/cstackex 259 - #96
Open
rajiv-jain-netapp wants to merge 3 commits into
Open
Conversation
rajiv-jain-netapp
requested review from
piyush5netapp,
sandeeplocharla and
suryag1201
as code owners
August 26, 2026 10:17
There was a problem hiding this comment.
Pull request overview
This PR enhances the ONTAP primary storage plugin to support template caching on the primary pool and subsequent fast VM disk provisioning via array-side cloning (instead of full template copies from secondary storage), including post-clone resizing when the service offering requires a larger disk.
Changes:
- Introduces
cloneCloudStackVolumeandresizeCloudStackVolumein the ONTAPStorageStrategyabstraction and implements them for SAN (LUN clone + LUN PATCH resize) and NAS (file clone + host-side qcow2 resize). - Extends
OntapPrimaryDatastoreDriverto (a) create and manage cached template objects on primary storage, (b) clone volumes from cached templates, and (c) handle template grant/revoke/delete workflows. - Updates ONTAP Feign clients/models and adds/extends tests to cover the new clone/resize and template-cache behaviors.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java | Implements template caching lifecycle and volume cloning-from-template flow; adds sizing and capabilities logic. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java | Replaces copy no-op with clone + resize abstractions for protocol-specific implementations. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedSANStrategy.java | Adds LUN clone creation and LUN resize (PATCH) support. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedNASStrategy.java | Adds file-clone support and qcow2 growth via KVM ResizeVolumeCommand; adds delete-by-path helper. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageConstants.java | Adds constants for template cache LUN naming and the cloneOfTemplate volume detail key. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageUtils.java | Removes now-redundant request builder helper (logic moved into the driver). |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SANFeignClient.java | Fixes/updates LUN PATCH endpoint and headers for resize support. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java | Adds ONTAP file-clone API call definition. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java | Adds JSON non-null inclusion for clone/source nested objects. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileCloneRequest.java | Adds request model for ONTAP file clone API. |
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriverTest.java | Adds coverage for template caching, clone-from-template, sizing, and template access lifecycle. |
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/UnifiedSANStrategyTest.java | Adds tests for LUN clone and resize validation. |
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/UnifiedNASStrategyTest.java | Adds tests for file clone, resize command dispatch, and delete-by-path behavior. |
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/StorageStrategyTest.java | Updates test stub to match new abstract strategy methods. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+402
to
+405
| String flexVolUuid = details.get(OntapStorageConstants.VOLUME_UUID); | ||
| ((UnifiedNASStrategy) storageStrategy).deleteFileByPath(flexVolUuid, filePath); | ||
| logger.info("deleteTemplateOnPrimary: Deleted template cache file [{}] for template [{}]", | ||
| filePath, templateInfo.getId()); |
Comment on lines
938
to
+946
| public long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool) { | ||
| return 0; | ||
| if (templateInfo == null || storagePool == null) { | ||
| return 0; | ||
| } | ||
| // Already cached on this pool, so deploying from it costs no additional space. | ||
| if (vmTemplatePoolDao.findByPoolTemplate(storagePool.getId(), templateInfo.getId(), null) != null) { | ||
| return 0; | ||
| } | ||
| return getDataObjectSizeIncludingHypervisorSnapshotReserve(templateInfo, storagePool); |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR...
VM create workflow: by default orchestrtor does full copy of the image from secondary to primary pool.
With this change, we are enabling plugin to cache the template local to the storage pool. That would make subsequent VM instance create faster.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?