Skip to content

Inject the template's download state in the secondary storage selectors#13025

Open
winterhazel wants to merge 1 commit intoapache:4.20from
scclouds:heuristics-to-avoid-template-redownload-4.20
Open

Inject the template's download state in the secondary storage selectors#13025
winterhazel wants to merge 1 commit intoapache:4.20from
scclouds:heuristics-to-avoid-template-redownload-4.20

Conversation

@winterhazel
Copy link
Copy Markdown
Member

Description

This PR adds the following preset variables to the secondary storage selectors of TEMPLATE resources:

Attribute Description
template.isPublic Whether the template is marked as public
template.downloadDetails List containing information about the template's state in each secondary storage that it is associated to
template.downloadDetails[i].dataStoreId UUID of the secondary storage
template.downloadDetails[i].downloadState Download state of template in secondary storage

Using them, it is possible to define heuristics to avoid the redownload/copy of public templates, for instance:

for (i = 0; i < template.downloadDetails.length; i++) {
  details = template.downloadDetails[i];
  if (template.isPublic && ['NOT_DOWNLOADED', 'DOWNLOAD_IN_PROGRESS', 'DOWNLOADED'].indexOf(details.downloadState) !== -1) {
    details.dataStoreId;
    break;
  }
}

The selector above will direct the template to a secondary storage that the template is already present when it is marked as public and downloaded/downloading. Hence, it will not be duplicated to other secondary storages.

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

Screenshots (if appropriate):

How Has This Been Tested?

In an environment with a single secondary storage, sec-nfs-1:

  1. I created a secondary storage selector for templates with the heuristic rule available above.
  2. I registered some public templates and waited until they finished downloading to sec-nfs-1.
  3. I added another secondary storage, sec-nfs-2, and verified that the existing public templates were not copied/downloaded to sec-nfs-2 because the secondary storage selector was directing them to sec-nfs-1.

@winterhazel
Copy link
Copy Markdown
Member Author

@blueorangutan package

@winterhazel winterhazel added this to the 4.20.4 milestone Apr 14, 2026
@blueorangutan
Copy link
Copy Markdown

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

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 4.15%. Comparing base (8eb162c) to head (250ea53).

❗ There is a different number of reports uploaded between BASE (8eb162c) and HEAD (250ea53). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (8eb162c) HEAD (250ea53)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               4.20   #13025       +/-   ##
=============================================
- Coverage     16.26%    4.15%   -12.11%     
=============================================
  Files          5665      404     -5261     
  Lines        500530    32966   -467564     
  Branches      60787     5893    -54894     
=============================================
- Hits          81411     1370    -80041     
+ Misses       410027    31420   -378607     
+ Partials       9092      176     -8916     
Flag Coverage Δ
uitests 4.15% <ø> (ø)
unittests ?

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.

@blueorangutan
Copy link
Copy Markdown

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

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