Skip to content

Powerflex fix#12880

Open
owsferraro wants to merge 2 commits intoapache:mainfrom
owsferraro:PowerflexFix
Open

Powerflex fix#12880
owsferraro wants to merge 2 commits intoapache:mainfrom
owsferraro:PowerflexFix

Conversation

@owsferraro
Copy link

Description

This PR fixes two bugs in the PowerFlex storage integration.

Fix 1: Snapshot volume ID ordering mismatch for VMs with multiple volumes
When taking a group snapshot of a VM with multiple volumes, CloudStack calls snapshotGroup.getVolumeIds() from the PowerFlex API to retrieve the resulting snapshot volume IDs and maps them positionally against a locally-built list of volumeTO objects. The PowerFlex API provides no guarantee that the returned snapshot volume IDs are in the same order as the source volumes were submitted. When PowerFlex returns the IDs in a different order, the snapshot volumes are recorded with incorrect associations in the CloudStack database, which can cause data integrity issues on restore.
The fix resolves this by matching each returned snapshot volume ID back to its corresponding source volume ID rather than relying on positional ordering.

Fix 2: Remove deprecated allowOnExtManagedVol parameter from overwriteVolumeContent
The PowerFlex API method overwriteVolumeContent, used during snapshot revert, accepted an allowOnExtManagedVol parameter in API version 3.5 that was removed in version 4.x. Passing this parameter against a PowerFlex 4.x deployment causes the API call to fail, breaking snapshot revert functionality entirely.
The fix removes the allowOnExtManagedVol parameter from the overwriteVolumeContent call to align with the PowerFlex 4.x API.

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?

Triggered a group snapshot on a VM with multiple volumes against a PowerFlex environment where the API returns snapshot volume IDs in a different order than the source volumes were submitted, and verified that all snapshot-to-volume associations are recorded correctly in the database.

Verified that snapshot revert (overwriteVolumeContent) completes successfully against a PowerFlex 4.6 deployment.
Verified no regression in snapshot and revert behaviour on standard single-volume VM snapshots.

How did you try to break this feature and the system with this change?

Tested group snapshots with varying numbers of volumes to confirm ordering is resolved correctly in all cases, not just a two-volume scenario.

Confirmed that removing allowOnExtManagedVol does not cause issues on the revert path beyond the version compatibility fix it addresses.

@boring-cyborg
Copy link

boring-cyborg bot commented Mar 24, 2026

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

Boolean overwriteVolumeContentStatus = post(
"/instances/Volume::" + destVolumeId + "/action/overwriteVolumeContent",
String.format("{\"srcVolumeId\":\"%s\",\"allowOnExtManagedVol\":\"TRUE\"}", sourceSnapshotVolumeId), Boolean.class);
String.format("{\"srcVolumeId\":\"%s\"}",sourceSnapshotVolumeId),Boolean.class);
Copy link
Contributor

@sureshanaparti sureshanaparti Mar 24, 2026

Choose a reason for hiding this comment

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

this will break the func with 3.x (and < 4.5) version

String pathWithScaleIOVolumeName = ScaleIOUtil.updatedPathWithVolumeName(volumeIds.get(index), volumeSnapshotName);
vmSnapshotDetails.add(new VMSnapshotDetailsVO(vmSnapshot.getId(), "Vol_" + volumeTOs.get(index).getId() + "_Snapshot", pathWithScaleIOVolumeName, false));
}
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the comment is not needed

vmSnapshotDetails.add(new VMSnapshotDetailsVO(vmSnapshot.getId(), "Vol_" + volumeTOs.get(index).getId() + "_Snapshot", pathWithScaleIOVolumeName, false));
}
*/
// Invert the srcVolumeDestSnapshotMap: snapshotName -> srcVolumePath
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Invert the srcVolumeDestSnapshotMap: snapshotName -> srcVolumePath

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.02%. Comparing base (b744824) to head (ed4bb4c).

Files with missing lines Patch % Lines
.../storage/vmsnapshot/ScaleIOVMSnapshotStrategy.java 0.00% 20 Missing ⚠️
...age/datastore/client/ScaleIOGatewayClientImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12880      +/-   ##
============================================
- Coverage     18.02%   18.02%   -0.01%     
- Complexity    16450    16451       +1     
============================================
  Files          5968     5968              
  Lines        537086   537102      +16     
  Branches      65961    65964       +3     
============================================
+ Hits          96819    96820       +1     
- Misses       429347   429362      +15     
  Partials      10920    10920              
Flag Coverage Δ
uitests 3.53% <ø> (ø)
unittests 19.19% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants