Skip to content

Support of snapshot copy to primary storage in different zones. #9478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

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

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 6.53442% with 801 lines in your changes missing coverage. Please review.

Project coverage is 16.74%. Comparing base (935c568) to head (738e293).
Report is 3 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 ⚠️
...tastore/driver/StorPoolPrimaryDataStoreDriver.java 0.00% 56 Missing ⚠️
...org/apache/cloudstack/snapshot/SnapshotHelper.java 16.94% 43 Missing and 6 partials ⚠️
...loudstack/storage/datastore/util/StorPoolUtil.java 0.00% 37 Missing ⚠️
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 20.51% 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 26 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9478      +/-   ##
============================================
- Coverage     16.74%   16.74%   -0.01%     
- Complexity    14063    14291     +228     
============================================
  Files          5724     5767      +43     
  Lines        507800   513393    +5593     
  Branches      61736    62481     +745     
============================================
+ Hits          85039    85965     +926     
- Misses       413278   417821    +4543     
- Partials       9483     9607     +124     
Flag Coverage Δ
uitests 3.85% <ø> (-0.05%) ⬇️
unittests 17.66% <6.53%> (-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.

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

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
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 slavkap force-pushed the support-snapshot-copy-on-primary branch from a2d1130 to feb0e9c Compare July 24, 2025 17:13
@slavkap
Copy link
Contributor Author

slavkap commented Jul 24, 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.

@blueorangutan
Copy link

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

@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

@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache CloudStack 4.21.0 Jul 25, 2025
@sureshanaparti sureshanaparti moved this from Done to In Progress in Apache CloudStack 4.21.0 Jul 25, 2025
@yalamovm
Copy link

I've performed the following tests:
✅ Snapshot copy between StorPool primary storages located in different zones: Succeeded.
✅ Snapshot deletion in one of the zones: Succeeded
❌ VM deployment from a snapshot and taking a new snapshot with the "copy" option: Failed with error:
"Cannot copy snapshot to primary storage. There aren't storage pools that support this operation."
❌ VM deployment from a snapshot with a copy in the second zone. Failed

Pool type to volumes that are created from snapshots
Added StorPool tags to snapshots that are copied from remote
@slavkap
Copy link
Contributor Author

slavkap commented Jul 25, 2025

Thank you, @yalamovm, for the tests!
@sureshanaparti, I fixed the issue from the third test. The last one, I don't think it is in the scope of this PR. I'll work on a fix/enhancement in a separate pull request, if that's okay with you?

@sureshanaparti
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti 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 14369

@blueorangutan
Copy link

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

Test Result Time (s) Test File
test_list_zones_metrics Error 0.21 test_metrics_api.py
test_02_prepare_and_cancel_shutdown Error 0.07 test_ms_maintenance_and_safe_shutdown.py
test_03_trigger_shutdown Error 0.28 test_ms_maintenance_and_safe_shutdown.py
test_nic_secondaryip_add_remove Error 6.57 test_multipleips_per_nic.py
test_nested_virtualization_vmware Error 0.02 test_nested_virtualization.py
ContextSuite context=TestNestedVirtualization>:teardown Error 0.05 test_nested_virtualization.py
test_network_acl Error 0.11 test_network_acl.py
test_network_acl Error 0.11 test_network_acl.py
ContextSuite context=TestNetworkACL>:teardown Error 0.13 test_network_acl.py
ContextSuite context=TestIpv6Network>:setup Error 0.00 test_network_ipv6.py
ContextSuite context=TestNetworkPermissions>:setup Error 0.00 test_network_permissions.py
test_delete_account Error 6.42 test_network.py
test_delete_network_while_vm_on_it Error 0.15 test_network.py
test_delete_network_while_vm_on_it Error 0.15 test_network.py
test_deploy_vm_l2network Error 0.14 test_network.py
test_deploy_vm_l2network Error 0.14 test_network.py
test_l2network_restart Error 0.31 test_network.py
test_l2network_restart Error 0.31 test_network.py
ContextSuite context=TestL2Networks>:teardown Error 0.33 test_network.py
ContextSuite context=TestPortForwarding>:setup Error 7.12 test_network.py
ContextSuite context=TestPublicIP>:setup Error 13.05 test_network.py
test_reboot_router Error 5.98 test_network.py
test_releaseIP Error 6.46 test_network.py
test_releaseIP_using_IP Error 6.42 test_network.py
ContextSuite context=TestRouterRules>:setup Error 12.99 test_network.py
test_01_deployVMInSharedNetwork Failure 0.02 test_network.py
test_02_verifyRouterIpAfterNetworkRestart Failure 0.01 test_network.py
test_03_destroySharedNetwork Failure 0.01 test_network.py
ContextSuite context=TestSharedNetwork>:teardown Error 0.06 test_network.py
test_01_deployVMInSharedNetwork Failure 0.01 test_network.py
ContextSuite context=TestSharedNetworkWithConfigDrive>:teardown Error 0.03 test_network.py
ContextSuite context=TestAdapterTypeForNic>:teardown Error 0.02 test_nic_adapter_type.py
test_01_nic Error 26.48 test_nic.py
test_extendPhysicalNetworkVlan Error 0.12 test_non_contigiousvlan.py
test_extendPhysicalNetworkVlan Error 0.12 test_non_contigiousvlan.py
test_01_non_strict_host_anti_affinity Error 0.02 test_nonstrict_affinity_group.py
test_02_non_strict_host_affinity Error 0.02 test_nonstrict_affinity_group.py
ContextSuite context=TestNonStrictAffinityGroups>:teardown Error 0.04 test_nonstrict_affinity_group.py
test_oobm_issue_power_cycle Error 0.18 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_off Error 0.17 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_on Error 0.15 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_reset Error 0.15 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_soft Error 0.14 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_status Error 0.14 test_outofbandmanagement_nestedplugin.py
ContextSuite context=TestIsolatedNetworksPasswdServer>:setup Error 0.00 test_password_server.py
all_test_persistent_network Skipped --- test_persistent_network.py
all_test_portable_publicip Skipped --- test_portable_publicip.py
all_test_portforwardingrules Skipped --- test_portforwardingrules.py
all_test_primary_storage Skipped --- test_primary_storage.py
all_test_primary_storage_scope Skipped --- test_primary_storage_scope.py
all_test_privategw_acl_ovs_gre Skipped --- test_privategw_acl_ovs_gre.py
all_test_privategw_acl Skipped --- test_privategw_acl.py
all_test_private_roles Skipped --- test_private_roles.py
all_test_projects Skipped --- test_projects.py
all_test_public_ip_range Skipped --- test_public_ip_range.py
all_test_purge_expunged_vms Skipped --- test_purge_expunged_vms.py
all_test_pvlan Skipped --- test_pvlan.py
all_test_quarantined_ips Skipped --- test_quarantined_ips.py
all_test_regions Skipped --- test_regions.py
all_test_register_userdata Skipped --- test_register_userdata.py
all_test_reset_configuration_settings Skipped --- test_reset_configuration_settings.py
all_test_reset_vm_on_reboot Skipped --- test_reset_vm_on_reboot.py
all_test_resource_accounting Skipped --- test_resource_accounting.py
all_test_resource_detail Skipped --- test_resource_detail.py
all_test_resource_names Skipped --- test_resource_names.py
all_test_restore_vm Skipped --- test_restore_vm.py
all_test_router_dhcphosts Skipped --- test_router_dhcphosts.py
all_test_router_dns Skipped --- test_router_dns.py
all_test_router_dnsservice Skipped --- test_router_dnsservice.py
all_test_routers_iptables_default_policy Skipped --- test_routers_iptables_default_policy.py
all_test_routers_network_ops Skipped --- test_routers_network_ops.py
all_test_routers Skipped --- test_routers.py
all_test_scale_vm Skipped --- test_scale_vm.py
all_test_secondary_storage Skipped --- test_secondary_storage.py
all_test_service_offerings Skipped --- test_service_offerings.py
all_test_set_sourcenat Skipped --- test_set_sourcenat.py
all_test_sharedfs_lifecycle Skipped --- test_sharedfs_lifecycle.py
all_test_snapshots Skipped --- test_snapshots.py
all_test_ssvm Skipped --- test_ssvm.py
all_test_staticroles Skipped --- test_staticroles.py
all_test_storage_policy Skipped --- test_storage_policy.py
all_test_templates Skipped --- test_templates.py
all_test_update_security_group Skipped --- test_update_security_group.py
all_test_usage_events Skipped --- test_usage_events.py
all_test_usage Skipped --- test_usage.py
all_test_vm_autoscaling Skipped --- test_vm_autoscaling.py
all_test_vm_deployment_planner Skipped --- test_vm_deployment_planner.py
all_test_vm_life_cycle Skipped --- test_vm_life_cycle.py
all_test_vm_lifecycle_unmanage_import Skipped --- test_vm_lifecycle_unmanage_import.py
all_test_vm_lifecycle_with_snapshot_or_volume Skipped --- test_vm_lifecycle_with_snapshot_or_volume.py
all_test_vm_schedule Skipped --- test_vm_schedule.py
all_test_vm_snapshot_kvm Skipped --- test_vm_snapshot_kvm.py
all_test_vm_snapshots Skipped --- test_vm_snapshots.py
all_test_vm_strict_host_tags Skipped --- test_vm_strict_host_tags.py
all_test_vnf_templates Skipped --- test_vnf_templates.py
all_test_volumes Skipped --- test_volumes.py
all_test_vpc_ipv6 Skipped --- test_vpc_ipv6.py
all_test_vpc_redundant Skipped --- test_vpc_redundant.py
all_test_vpc_router_nics Skipped --- test_vpc_router_nics.py
all_test_vpc_vpn Skipped --- test_vpc_vpn.py
all_test_webhook_delivery Skipped --- test_webhook_delivery.py
all_test_webhook_lifecycle Skipped --- test_webhook_lifecycle.py
all_test_host_maintenance Skipped --- test_host_maintenance.py
all_test_hostha_kvm Skipped --- test_hostha_kvm.py

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

9 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy