Skip to content

Conversation

@slavkap
Copy link
Contributor

@slavkap slavkap commented Aug 1, 2024

Description

This PR allows copying a snapshot from a primary storage pool in one zone to a primary storage pool in different zones without involving secondary storage.
This feature is currently implemented only in the StorPool storage plugin. Other storage plugins can add this feature if the storage pools support direct copies of snapshots from one pool to another.

Added additional API param usestoragereplication and one more for Admin users storageids in CloudStack API calls:

createSnapshot
copySnapshot
createSnapshotPolicy

The option snapshot.backup.to.secondary does not apply to the copy functionality. The snapshots will be copied only to the required primary storage in a different zone.
The user can create volumes/templates from the copied snapshots. The user can make copies only to a primary or to a secondary storage - at the moment, there is no option to do the copy on both.

The destination zone is a mandatory parameter if the users want to copy a snapshot, and the usestoragereplication if the copy has to be on the primary storage

For Admin users:
Those users can define the primary destination storage for the copy or to enable the setting use.storage.replication in the Primary storage settings.
image
image
image

For regular Users:
The Admin should enable the configuration setting use.storage.replication in the Primary storage settings.
image
image
image

For other storage plugins that want to adopt this functionality:

  • The Primary storage driver should have the capability CAN_COPY_SNAPSHOT_BETWEEN_ZONES
  • the respective plugin needs to implement the copySnapshot method in their SnapshotStrategy and that the driver can handle the COPY operation

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

  • Major
  • Minor

Screenshots (if appropriate):

How Has This Been Tested?

Manual and smoke tests with StorPool primary storage on multiple zones

@codecov
Copy link

codecov bot commented Aug 1, 2024

Codecov Report

❌ Patch coverage is 6.69746% with 808 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.33%. Comparing base (a60c8ca) to head (6668140).
⚠️ Report is 38 commits behind head on main.

Files with missing lines Patch % Lines
...om/cloud/storage/snapshot/SnapshotManagerImpl.java 8.08% 174 Missing and 8 partials ⚠️
...ack/storage/snapshot/StorPoolSnapshotStrategy.java 0.00% 154 Missing ⚠️
...age/collector/StorPoolAbandonObjectsCollector.java 0.00% 69 Missing ⚠️
...org/apache/cloudstack/snapshot/SnapshotHelper.java 14.70% 52 Missing and 6 partials ⚠️
...tastore/driver/StorPoolPrimaryDataStoreDriver.java 0.00% 56 Missing ⚠️
...loudstack/storage/datastore/util/StorPoolUtil.java 0.00% 37 Missing ⚠️
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 24.39% 29 Missing and 2 partials ⚠️
...oudstack/storage/snapshot/SnapshotServiceImpl.java 0.00% 27 Missing ⚠️
...e/wrapper/StorPoolModifyStorageCommandWrapper.java 0.00% 21 Missing ⚠️
...udstack/storage/datastore/util/StorPoolHelper.java 0.00% 21 Missing ⚠️
... and 25 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9478      +/-   ##
============================================
- Coverage     17.35%   17.33%   -0.02%     
- Complexity    15189    15198       +9     
============================================
  Files          5883     5883              
  Lines        524514   525259     +745     
  Branches      64007    64131     +124     
============================================
+ Hits          91013    91042      +29     
- Misses       423216   423924     +708     
- Partials      10285    10293       +8     
Flag Coverage Δ
uitests 3.63% <ø> (-0.01%) ⬇️
unittests 18.37% <6.69%> (-0.03%) ⬇️

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.

@slavkap slavkap force-pushed the support-snapshot-copy-on-primary branch from 8cc7b49 to 0df6764 Compare August 14, 2024 09:14
@slavkap slavkap marked this pull request as ready for review August 14, 2024 09:51
@slavkap slavkap changed the title [WIP] Support of snapshot copy to StorPool primary storage in different zones Support of snapshot copy to StorPool primary storage in different zones Aug 14, 2024
@github-actions
Copy link

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

@slavkap slavkap force-pushed the support-snapshot-copy-on-primary branch from 0df6764 to e0f4283 Compare August 22, 2024 12:49
@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10756

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-11155)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 51322 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9478-t11155-kvm-ol8.zip
Smoke tests completed. 137 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_snapshot_usage Failure 38.32 test_usage.py
test_01_vpc_site2site_vpn Failure 308.08 test_vpc_vpn.py

@github-actions
Copy link

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

@slavkap slavkap force-pushed the support-snapshot-copy-on-primary branch from e0f4283 to 6f209d8 Compare August 30, 2024 09:08
@github-actions
Copy link

github-actions bot commented Sep 4, 2024

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

slavkap added 15 commits August 1, 2025 11:52
…n zones

Added support to copy a snapshot to another StorPool primary storage in
different zones.
Added drop down to choose the primary storage pools to copy a snapshot
Small fixes
hide the primary storage from the users in the UI
refactor smoke test
fix copy when reccuring snapshot
fix UI after rebasing
Pool type to volumes that are created from snapshots
Added StorPool tags to snapshots that are copied from remote
@slavkap slavkap force-pushed the support-snapshot-copy-on-primary branch from 4c91d28 to 6668140 Compare August 1, 2025 10:40
@slavkap
Copy link
Contributor Author

slavkap commented Aug 1, 2025

@blueorangutan package

@blueorangutan
Copy link

@slavkap a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@slavkap
Copy link
Contributor Author

slavkap commented Aug 1, 2025

Thank you, @rosi-shapeblue, for the detailed information!

The UI issue with the label has been fixed in the latest commit. Additionally, snapshot allocation will no longer occur if the storage doesn't support copying to another zone.
image

I’ve tested snapshot copying between zones using StorPool, and confirmed that this feature doesn't break existing functionality for copying snapshots between zones on secondary storage. Testing was also done with NFS as the primary storage.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14503

@sureshanaparti
Copy link
Contributor

@rosi-shapeblue can you check if your concerns are addressed?

Copy link
Collaborator

@rosi-shapeblue rosi-shapeblue left a comment

Choose a reason for hiding this comment

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

LGTM. The issues that were discussed have been addressed.

image

@sureshanaparti
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@sureshanaparti sureshanaparti merged commit e5f6116 into apache:main Aug 4, 2025
23 of 26 checks passed
@blueorangutan
Copy link

[SF] Trillian test result (tid-14022)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 47587 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9478-t14022-kvm-ol8.zip
Smoke tests completed. 146 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Aug 6, 2025
…he#9478)

* Support of snapshot copy to different StorPool primary storage between zones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

10 participants