api: create/register/upload template with empty template tag#12234
Conversation
|
@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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 4.20 #12234 +/- ##
=============================================
- Coverage 16.21% 4.00% -12.22%
=============================================
Files 5657 402 -5255
Lines 498647 32677 -465970
Branches 60533 5812 -54721
=============================================
- Hits 80863 1309 -79554
+ Misses 408771 31213 -377558
+ Partials 9013 155 -8858
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:
|
DaanHoogland
left a comment
There was a problem hiding this comment.
code lgtm, was there an issue associated with this @weizhouapache ?
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15998 |
I did not create a github issue. I have faced the issue since several years ago that some vm templates have template tag as "", not NULL, which confused me. |
There was a problem hiding this comment.
LGTM
The fix works correctly - it properly catches both empty strings and whitespace-only strings, converting them to NULL which allows VM deployment to succeed.
Test Cases Executed:
- Register template with empty tag (templatetag="") → stored as NULL - PASS
- Register template with whitespace-only tag (templatetag=" ") → stored as NULL - PASS
- Register template with valid tag (templatetag="my-valid-tag") → stored correctly - PASS
- VM deployment from template with empty tag → VM running - PASS
Evidence
VM deployed
(localcloud) 🐱 > deploy virtualmachine serviceofferingid="5d2b9b28-1bff-4b46-ab6f-878294298e3b" templateid="681009e5-ee32-4694-804c-e848ea0e5bec" zoneid="1acdbdba-d51a-4b71-9b6e-cf302454459d" name="vm-from-empty-tag-template"
{
"virtualmachine": {
"account": "admin",
"affinitygroup": [],
"arch": "x86_64",
"cpunumber": 1,
"cpuspeed": 500,
"created": "2025-12-13T13:36:25+0000",
"deleteprotection": false,
"details": {
"cpuOvercommitRatio": "2.0"
},
"displayname": "vm-from-empty-tag-template",
"displayvm": true,
"domain": "ROOT",
"domainid": "14020525-d813-11f0-98a0-1e00d40003ba",
"domainpath": "/",
"guestosid": "36370517-d813-11f0-98a0-1e00d40003ba",
"haenable": false,
"hasannotations": false,
"hostcontrolstate": "Enabled",
"hostid": "71445e5d-af50-4bce-b545-5f768fd60837",
"hostname": "ref-trl-10391-k-Mol8-rositsa-kyuchukova-kvm2",
"hypervisor": "KVM",
"id": "e05ad3e2-6fe2-4384-bc2f-a4d24da32a7a",
"instancename": "i-2-3-VM",
"ipaddress": "10.1.1.100",
"isdynamicallyscalable": false,
"jobid": "c9df5475-f042-4a83-974b-9589e9def7b5",
"jobstatus": 0,
"lastupdated": "2025-12-13T13:37:20+0000",
"memory": 512,
"name": "vm-from-empty-tag-template",
"nic": [
{
"broadcasturi": "vlan://1844",
"deviceid": "0",
"extradhcpoption": [],
"gateway": "10.1.1.1",
"id": "0818119d-2d21-456f-a86f-a3bbdd15afaf",
"ipaddress": "10.1.1.100",
"isdefault": true,
"isolationuri": "vlan://1844",
"macaddress": "02:01:00:cc:00:01",
"netmask": "255.255.255.0",
"networkid": "265861c3-73d1-4a5f-9d9a-688a392b371f",
"networkname": "admin-network",
"secondaryip": [],
"traffictype": "Guest",
"type": "Isolated"
}
],
"osdisplayname": "Debian GNU/Linux 9 (64-bit)",
"ostypeid": "36370517-d813-11f0-98a0-1e00d40003ba",
"passwordenabled": false,
"pooltype": "NetworkFilesystem",
"receivedbytes": 0,
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"sentbytes": 0,
"serviceofferingid": "5d2b9b28-1bff-4b46-ab6f-878294298e3b",
"serviceofferingname": "Small Instance",
"state": "Running",
"tags": [],
"templatedisplaytext": "Test Empty Tag",
"templateformat": "QCOW2",
"templateid": "681009e5-ee32-4694-804c-e848ea0e5bec",
"templatename": "test-empty-tag",
"templatetype": "USER",
"userid": "4db2db97-d813-11f0-98a0-1e00d40003ba",
"username": "admin",
"zoneid": "1acdbdba-d51a-4b71-9b6e-cf302454459d",
"zonename": "ref-trl-10391-k-Mol8-rositsa-kyuchukova"
}
}
|
@blueorangutan test |
|
@RosiKyu a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-14979) |
|
@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-14980)
|
|
@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-14996)
|
* 4.22: Update templateConfig.sh to not break with directorys with space on t… (#10898) Fix VM and volume metrics listing regressions (#12284) packaging: use latest cmk release link directly (#11429) api:rename RegisterCmd.java => RegisterUserKeyCmd.java (#12259) Prioritize copying templates from other secondary storages instead of downloading them (#10363) Show time correctly in the backup schedule UI (#12012) kvm: use preallocation option for fat disk resize (#11986) Python exception processing static routes fixed (#11967) KVM memballooning requires free page reporting and autodeflate (#11932) api: create/register/upload template with empty template tag (#12234)
Description
This PR fixes an issue when register/create/upload a template
template tag, then chean it on UINULLwith this PR, template tag will be
NULLTypes 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?