Add config keys for controlling public/private template secondary storage replica counts#12877
Add config keys for controlling public/private template secondary storage replica counts#12877Damans227 wants to merge 15 commits into
Conversation
…rage replica counts
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12877 +/- ##
============================================
+ Coverage 18.02% 18.10% +0.08%
- Complexity 16450 16761 +311
============================================
Files 5968 6037 +69
Lines 537086 542985 +5899
Branches 65961 66502 +541
============================================
+ Hits 96819 98326 +1507
- Misses 429347 433608 +4261
- Partials 10920 11051 +131
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17224 |
There was a problem hiding this comment.
Pull request overview
This PR introduces new template-related configuration keys intended to control how many secondary storage replicas are created for public vs private templates, decoupling replication behavior from template visibility.
Changes:
- Adds two new Zone-scoped
ConfigKey<Integer>settings:public.template.secstorage.copyandprivate.template.secstorage.copy. - Reworks secondary storage allocation logic to enforce a per-zone replica limit using a zone→count map.
- Updates unit tests to match the new method signatures/replica-limit behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
engine/components-api/src/main/java/com/cloud/template/TemplateManager.java |
Adds new Zone-scoped config keys for public/private template replica limits. |
server/src/main/java/com/cloud/template/TemplateManagerImpl.java |
Registers the new config keys via getConfigKeys(). |
server/src/main/java/com/cloud/template/TemplateAdapterBase.java |
Replaces zone-set visibility logic with zone copy counting + replica limit enforcement. |
server/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java |
Threads replica-limit and zone copy count through template creation/allocation paths. |
server/src/test/java/com/cloud/template/HypervisorTemplateAdapterTest.java |
Updates tests for the new signatures and adds coverage for replica-limit behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * If the template/ISO is marked as private, then it is allocated to a random secondary storage; otherwise, allocates to every storage pool in every zone given by the | ||
| * {@link TemplateProfile#getZoneIdList()}. | ||
| */ | ||
| protected void postUploadAllocation(List<DataStore> imageStores, VMTemplateVO template, List<TemplateOrVolumePostUploadCommand> payloads) { |
There was a problem hiding this comment.
This method JavaDoc no longer matches the behavior: allocation is now governed by replica-limit config keys (public/private can both be limited), not strictly by template visibility (private=random vs public=all). Please update the comment to reflect the new replica-limit semantics (and that the limits are zone-scoped).
| ConfigKey<Integer> PublicTemplateSecStorageCopy = new ConfigKey<Integer>("Advanced", Integer.class, | ||
| PublicTemplateSecStorageCopyCK, "0", | ||
| "Maximum number of secondary storage pools to which a public template is copied. " + | ||
| "0 means copy to all secondary storage pools (default behavior).", | ||
| true, ConfigKey.Scope.Zone); | ||
|
|
||
| ConfigKey<Integer> PrivateTemplateSecStorageCopy = new ConfigKey<Integer>("Advanced", Integer.class, | ||
| PrivateTemplateSecStorageCopyCK, "1", | ||
| "Maximum number of secondary storage pools to which a private template is copied. " + | ||
| "Default is 1 to preserve existing behavior.", | ||
| true, ConfigKey.Scope.Zone); |
There was a problem hiding this comment.
The config key descriptions don’t mention that the limits are evaluated per-zone (and the keys themselves are zone-scoped). Consider clarifying the wording (e.g., “per zone”) so operators understand how replica limits are applied across multiple zones/image stores.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17501 |
|
@Damans227 update the description with update config names. |
Done. Thanks! |
…limit logic and update related tests
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17996 |
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18021 |
… template creation
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18056 |
…limits and schedule additional copies for cross-zone templates
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18063 |
…apacity during template management
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18078 |
|
@blueorangutan test |
|
@kiranchavala a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-16260) |
|
@blueorangutan test |
|
@kiranchavala a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-16286)
|
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM
Tested the feature manually.
The Public and private Templates honor the global setting value of secstorage.public.template.copy.max and secstorage.private.template.copy.max and copies the template to the respective secondary storage.
| validate secstorage.public.template.copy.max at global and zone level | Pass |
|---|---|
| validate secstorage.private.template.copy.max at global and zone level | Pass |
| Validate publlic and private template creation operation from volume | Pass |
| Validate publlic and private template creation operation from a volume snapshot | Pass |
| Validate Upload Template operation from Local | Pass |
| Validate Copy Template operation from one zone to another | Pass |
| Validate Update Template operation from public to private and vice versa | Pass |
great, thanks @kiranchavala @harikrishna-patnala |
Description
Adds two new operator-level configuration keys to control the number of secondary storage copies made for public and private templates, decoupling replica count from template visibility.
secstorage.public.template.copy.max(default: 0 = all stores, preserving existing behavior)secstorage.private.template.copy.max(default: 1, preserving existing behavior)Doc PR: apache/cloudstack-documentation#643
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
How Has This Been Tested?
HypervisorTemplateAdapterTestcovering the new replica-limit logic inisZoneAndImageStoreAvailable.