Delete template from storage pool instantly if no volume is using it#11782
Delete template from storage pool instantly if no volume is using it#11782DaanHoogland merged 2 commits intoapache:4.20from
Conversation
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@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. |
server/src/main/java/com/cloud/template/TemplateManagerImpl.java
Outdated
Show resolved
Hide resolved
weizhouapache
left a comment
There was a problem hiding this comment.
code lgtm
thanks @abh1sar
|
@blueorangutan package |
|
@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. |
|
Packaging result [SF]: ✔️ debian. SL-JID 15274 |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15276 |
|
@blueorangutan test |
|
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-14517)
|
engine/components-api/src/main/java/com/cloud/template/TemplateManager.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to immediately delete template files from primary storage when templates are deleted, controlled by a new configuration setting. The feature helps prevent storage accumulation of unused template files by proactively evicting them during template deletion operations.
- Introduces
template.delete.from.primary.storageconfiguration key to toggle instant template deletion from primary storage - Refactors template usage checking logic into reusable method
templateIsUnusedInPool() - Adds new method
evictTemplateFromStoragePoolsForZones()to delete templates from specific zones
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TemplateManagerImpl.java | Core implementation of template eviction logic with new configuration key |
| HypervisorTemplateAdapter.java | Integration of eviction calls during template deletion workflow |
| PrimaryDataStoreDaoImpl.java | Database layer support for querying storage pools by data center IDs |
| PrimaryDataStoreDao.java | Interface addition for data center-based pool queries |
| VMTemplatePoolDaoImpl.java | Database implementation for querying template-pool relationships |
| VMTemplatePoolDao.java | Interface addition for template-pool relationship queries |
| TemplateManager.java | Interface definitions for new template eviction functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java
Show resolved
Hide resolved
vishesh92
left a comment
There was a problem hiding this comment.
clgtm. Tested with 1 zone. Works as expected.
Description
This PR fixes #10688
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
template.delete.from.primary.storagesetting togglezoneIdzoneId=zoneAHow did you try to break this feature and the system with this change?