cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Support of snapshot copy to primary storage in different zones.

Open slavkap opened this issue 1 year ago • 43 comments

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)
  • [X] 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

  • [X] Major
  • [ ] Minor

Screenshots (if appropriate):

How Has This Been Tested?

Manual and smoke tests with StorPool primary storage on multiple zones

slavkap avatar Aug 01 '24 13:08 slavkap

Codecov Report

:x: Patch coverage is 6.69746% with 808 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 17.33%. Comparing base (a60c8ca) to head (6668140). :warning: 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 :warning:
...ack/storage/snapshot/StorPoolSnapshotStrategy.java 0.00% 154 Missing :warning:
...age/collector/StorPoolAbandonObjectsCollector.java 0.00% 69 Missing :warning:
...org/apache/cloudstack/snapshot/SnapshotHelper.java 14.70% 52 Missing and 6 partials :warning:
...tastore/driver/StorPoolPrimaryDataStoreDriver.java 0.00% 56 Missing :warning:
...loudstack/storage/datastore/util/StorPoolUtil.java 0.00% 37 Missing :warning:
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 24.39% 29 Missing and 2 partials :warning:
...oudstack/storage/snapshot/SnapshotServiceImpl.java 0.00% 27 Missing :warning:
...e/wrapper/StorPoolModifyStorageCommandWrapper.java 0.00% 21 Missing :warning:
...udstack/storage/datastore/util/StorPoolHelper.java 0.00% 21 Missing :warning:
... 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%) :arrow_down:
unittests 18.37% <6.69%> (-0.03%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Aug 01 '24 13:08 codecov[bot]

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

github-actions[bot] avatar Aug 21 '24 08:08 github-actions[bot]

@blueorangutan package

DaanHoogland avatar Aug 22 '24 13:08 DaanHoogland

@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 avatar Aug 22 '24 13:08 blueorangutan

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

blueorangutan avatar Aug 22 '24 15:08 blueorangutan

@blueorangutan test

DaanHoogland avatar Aug 23 '24 07:08 DaanHoogland

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

blueorangutan avatar Aug 23 '24 07:08 blueorangutan

[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

blueorangutan avatar Aug 23 '24 22:08 blueorangutan

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

github-actions[bot] avatar Aug 29 '24 08:08 github-actions[bot]

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

github-actions[bot] avatar Sep 04 '24 08:09 github-actions[bot]

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

github-actions[bot] avatar Oct 10 '24 20:10 github-actions[bot]

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

github-actions[bot] avatar Oct 15 '24 07:10 github-actions[bot]

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

github-actions[bot] avatar Nov 04 '24 14:11 github-actions[bot]

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

github-actions[bot] avatar Jan 08 '25 13:01 github-actions[bot]

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

github-actions[bot] avatar Jan 29 '25 08:01 github-actions[bot]

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

github-actions[bot] avatar Feb 12 '25 20:02 github-actions[bot]

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

github-actions[bot] avatar May 02 '25 01:05 github-actions[bot]

Thank you @DaanHoogland, @sureshanaparti and @nvazquez for the reviews! I think I addressed all the requested changes

slavkap avatar Jun 06 '25 12:06 slavkap

@blueorangutan package

nvazquez avatar Jun 06 '25 13:06 nvazquez

@nvazquez 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 avatar Jun 06 '25 13:06 blueorangutan

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

blueorangutan avatar Jun 06 '25 14:06 blueorangutan

@blueorangutan test

nvazquez avatar Jun 06 '25 15:06 nvazquez

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

blueorangutan avatar Jun 06 '25 15:06 blueorangutan

[SF] Trillian test result (tid-13476) Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 55708 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9478-t13476-kvm-ol8.zip Smoke tests completed. 140 look OK, 1 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 25.95 test_usage.py

blueorangutan avatar Jun 07 '25 07:06 blueorangutan

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

github-actions[bot] avatar Jun 10 '25 10:06 github-actions[bot]

@blueorangutan package

slavkap avatar Jun 11 '25 12:06 slavkap

@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.

blueorangutan avatar Jun 11 '25 12:06 blueorangutan

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13712

blueorangutan avatar Jun 11 '25 13:06 blueorangutan

@blueorangutan package

rohityadavcloud avatar Jun 11 '25 14:06 rohityadavcloud

@rohityadavcloud 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 avatar Jun 11 '25 14:06 blueorangutan