server: set template type to ROUTING or USER if template type is not specified when upload a template#12768
Conversation
…specified when upload a template
|
@DaanHoogland @vishesh92 @vladimirpetrov |
e6d952c to
9dd0695
Compare
|
@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. |
Sounds good, is type null leading to NPEs? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #12768 +/- ##
============================================
- Coverage 17.61% 17.61% -0.01%
- Complexity 15661 15662 +1
============================================
Files 5917 5917
Lines 531402 531404 +2
Branches 64971 64972 +1
============================================
- Hits 93586 93585 -1
- Misses 427262 427264 +2
- Partials 10554 10555 +1
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:
|
I think it does not lead to NPEs, but template/iso are not usable as the type is NULL. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 17039 |
|
@blueorangutan package |
There was a problem hiding this comment.
Pull request overview
Updates template upload/registration validation to default the template type to ROUTING or USER when not explicitly provided, and aligns existing DB records by backfilling vm_template.type when it is NULL.
Changes:
- Extend template-type defaulting logic to
GetUploadParamsForTemplateCmd. - Add permission validation/error for non-admin users requesting upload params for non-
USERtemplate types. - Backfill
cloud.vm_template.typetoUSERwhere it is currentlyNULL.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server/src/main/java/com/cloud/template/TemplateManagerImpl.java | Default template type for upload-params requests and restrict non-admin usage for non-USER types. |
| engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql | Data migration to set vm_template.type to USER for existing NULL rows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/template/TemplateManagerImpl.java
Outdated
Show resolved
Hide resolved
…10.sql Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@blueoranguran package |
1 similar comment
|
@blueoranguran package |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17049 |
|
@blueorangutan test |
|
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Description
This PR fixes #12763
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?