Skip to content

Conversation

abh1sar
Copy link
Collaborator

@abh1sar abh1sar commented Oct 3, 2025

Description

This PR fixes #10688

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

# Scenario Action Observed Result
1 template.delete.from.primary.storage setting toggle Delete template with setting true vs false Template file deleted only if setting is true
2 Instance created from template, then template deleted with force=true Delete template (force) without deleting the instance Template file not deleted from Primary Storage
3 Template installed on 2 zones, VMs created and expunged everywhere Delete template without specifying zoneId Template files deleted from all Primary Storages
4 Template installed on 2 zones, VMs created and expunged everywhere Delete template specifying only zoneId=zoneA Template file deleted only on Primary Storages belonging to zoneA

How did you try to break this feature and the system with this change?

Copy link

codecov bot commented Oct 3, 2025

Codecov Report

❌ Patch coverage is 8.51064% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.17%. Comparing base (c631d6a) to head (0d316b5).
⚠️ Report is 2 commits behind head on 4.20.

Files with missing lines Patch % Lines
...n/java/com/cloud/template/TemplateManagerImpl.java 0.00% 23 Missing ⚠️
...a/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java 0.00% 7 Missing ⚠️
.../storage/datastore/db/PrimaryDataStoreDaoImpl.java 30.00% 7 Missing ⚠️
.../com/cloud/template/HypervisorTemplateAdapter.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #11782      +/-   ##
============================================
- Coverage     16.17%   16.17%   -0.01%     
+ Complexity    13298    13297       -1     
============================================
  Files          5656     5656              
  Lines        498242   498282      +40     
  Branches      60458    60466       +8     
============================================
+ Hits          80584    80590       +6     
- Misses       408686   408722      +36     
+ Partials       8972     8970       -2     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.02% <8.51%> (-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.

@abh1sar
Copy link
Collaborator Author

abh1sar commented Oct 3, 2025

@blueorangutan package

@blueorangutan
Copy link

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

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

thanks @abh1sar

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache 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]: ✔️ debian. SL-JID 15274

@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@weizhouapache 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-14517)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 55925 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11782-t14517-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_13_retrieve_vr_default_files Error 1.14 test_diagnostics.py
test_14_retrieve_vr_one_file Error 1.14 test_diagnostics.py
test_15_retrieve_ssvm_default_files Error 1.14 test_diagnostics.py
test_16_retrieve_ssvm_single_file Error 1.14 test_diagnostics.py
test_17_retrieve_cpvm_default_files Error 0.11 test_diagnostics.py
test_18_retrieve_cpvm_single_file Error 1.13 test_diagnostics.py

+ "will validate if the provided URL is resolvable during the register of templates/ISOs before persisting them in the database.",
true);

ConfigKey<Boolean> TemplateDeleteFromPrimaryStorage = new ConfigKey<Boolean>("Advanced",
Copy link
Contributor

Choose a reason for hiding this comment

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

@abh1sar do we really need a global setting for this usecase, I think we can directly delete the template if there is no usage found.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@harikrishna-patnala I added it as a failsafe or in case someone doesn't care about how faster the space is reclaimed, but doesn't want to risk any kind of data loss. Also in case someone wants to use the setting storage.template.cleanup.enabled=false or storage.cleanup.enabled=false where the deleted template is never cleaned up.

@weizhouapache weizhouapache added this to the 4.20.2 milestone Oct 6, 2025
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.

Deleting template does not remove the template images on primary storages
4 participants