CSTACKEX:200 - added temp CG logic for VM snapshots if VM span across…#67
CSTACKEX:200 - added temp CG logic for VM snapshots if VM span across…#67rajiv-jain-netapp wants to merge 1 commit into
Conversation
|
Testing:
|
There was a problem hiding this comment.
Pull request overview
This PR extends CloudStack’s snapshot handling for ONTAP-managed storage by adding temporary consistency-group (CG) orchestration for VM snapshots that span multiple FlexVols, while also tightening snapshot archival behavior so managed-primary snapshots remain on array/primary storage.
Changes:
- Add temporary ONTAP consistency-group (two-phase start+commit) flow for VM snapshots spanning multiple FlexVols; use direct FlexVol snapshots for single-FlexVol cases.
- Adjust snapshot archival-to-secondary logic to avoid secondary bookkeeping/copy for managed primary snapshots (e.g., ONTAP volume snapshots kept on PRIMARY).
- Refactor ONTAP strategy utilities: introduce “operations-only” connect mode, add job polling helpers, and centralize delete/revert logic in
StorageStrategy.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java | Avoids archiving managed-primary snapshots to secondary; clarifies behavior and logging. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/vmsnapshot/OntapVMSnapshotStrategy.java | Implements temporary CG orchestration for multi-FlexVol VM snapshots; refactors snapshot naming and strategy resolution. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageUtils.java | Changes strategy connection defaults and adds overload to control aggregate validation. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageConstants.java | Adds CG/SVM UUID constants and polling configuration knobs. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java | Adds operations-only connect path, job polling helpers, and shared snapshot delete orchestration. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java | Persists resolved SVM UUID into pool details during initialization. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SnapshotFeignClient.java | Adds Feign bindings for consistency-group and CG snapshot APIs. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java | Delegates volume-snapshot delete and revert orchestration into StorageStrategy; updates capability flags and snapshot naming. |
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/vmsnapshot/OntapVMSnapshotStrategyTest.java | Adds unit tests covering single-FlexVol vs CG flows, scope validation, and snapshot naming updates. |
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/StorageStrategyTest.java | Extends tests for operations-only connect and new polling/delete helpers. |
| plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriverTest.java | Updates capability expectations (revert supported). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * Returns a connected {@link StorageStrategy} for operations on an existing pool (snapshots, | ||
| * delete, revert, grant/revoke). Does not require aggregate free space for the full pool size. | ||
| */ | ||
| public static StorageStrategy getStrategyByStoragePoolDetails(Map<String, String> details) { | ||
| return getStrategyByStoragePoolDetails(details, false); | ||
| } |
| /** | ||
| * Single GET attempt: match by name, then fall back to listing all CG snapshots in this group (And it would one | ||
| * always since workflow is keep deleting the CG). | ||
| */ |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
| if (lunUUID == null) { | ||
| throw new CloudRuntimeException("LUN UUID not found for iSCSI volume " + volumeVO.getId()); | ||
| } | ||
| lunUuid = lunUUID; |
There was a problem hiding this comment.
no need of this extra lunUuid variable assignment with temp lunUUID var, can be done directly also
| name = StringUtils.left(volumeName, volumeName.length() - trimRequired) + "-" + snapshotUuid; | ||
| } | ||
| return name; | ||
| private String buildSnapshotName(String cloudStackSnapshotName, long snapshotId) { |
There was a problem hiding this comment.
as discussed, we have to check for two cloudstack using same ontap.
| } | ||
| return name; | ||
| private String buildSnapshotName(String cloudStackSnapshotName, long snapshotId) { | ||
| return OntapStorageUtils.buildOntapSnapshotName(cloudStackSnapshotName, "cs" + snapshotId); |
There was a problem hiding this comment.
we can move this cs to constant
Also, for better readability use - (hyphen)
Please add example for snapshot name
| @RequestLine("POST /api/application/consistency-groups") | ||
| @Headers({"Authorization: {authHeader}", "Content-Type: application/json"}) | ||
| JobResponse createConsistencyGroup(@Param("authHeader") String authHeader, | ||
| Map<String, Object> request); |
There was a problem hiding this comment.
to create CG, request should be model type why map?
| */ | ||
| @RequestLine("GET /api/application/consistency-groups") | ||
| @Headers({"Authorization: {authHeader}"}) | ||
| OntapResponse<Map<String, Object>> getConsistencyGroups(@Param("authHeader") String authHeader, |
There was a problem hiding this comment.
the return type should be OntapResponse
| */ | ||
| @RequestLine("POST /api/application/consistency-groups/{cgUuid}/snapshots") | ||
| @Headers({"Authorization: {authHeader}", "Content-Type: application/json"}) | ||
| JobResponse createConsistencyGroupSnapshot(@Param("authHeader") String authHeader, |
| */ | ||
| @RequestLine("GET /api/application/consistency-groups/{cgUuid}/snapshots") | ||
| @Headers({"Authorization: {authHeader}"}) | ||
| OntapResponse<Map<String, Object>> getConsistencyGroupSnapshots(@Param("authHeader") String authHeader, |
| * Presents aggregate object for the unified storage, not eligible for disaggregated | ||
| */ | ||
| private List<Aggregate> aggregates; | ||
| private String resolvedSvmUuid; |
There was a problem hiding this comment.
svmUUID should be fine instead resolvedSvmUuid
| groupInfo.volumeIds); | ||
| // CG orchestration is only required when VM disks span multiple FlexVols. | ||
| // A single FlexVol already provides atomic capture for all volumes on that FlexVol. | ||
| if (flexVolGroups.size() > 1) { |
There was a problem hiding this comment.
can we also test, VM span across mutiple storage pool where svms are also diff
26f20d7 to
3a04b7e
Compare
… multiple volumes at storage
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?