api,server: allow cleaning up vm extraconfig
Description
Fixes #9878
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)
- [x] 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?
(local) π± > update virtualmachine -h
updateVirtualMachine: Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.
Required params: id,
API Params Type Description
========== ==== ===========
cleanupdetails boolean optional boolean field, which indicates i
f details should be cleaned up or not (i
f set to true, details removed for this
resource, details field ignored; if fals
e or not set, no action)
cleanupextraconfig boolean Optional boolean field, which indicates i
f extraconfig for the instance should be
cleaned up or not (If set to true, extr
aconfig removed for this instance, extra
config field ignored; if false or not se
t, no action)
customid string an optional field, in case you want to se
t a custom id to the resource. Allowed t
o Root Admins only
...
(localcloud) π± > list virtualmachines id=d6c566f9-bec2-4daf-b1fb-2da25683229e filter=id,name,details
{
"count": 1,
"virtualmachine": [
{
"details": {
"cpuOvercommitRatio": "2.0",
"extraconfig-1": "alpha=123\nbeta=456"
},
"id": "d6c566f9-bec2-4daf-b1fb-2da25683229e",
"name": "VM-d6c566f9-bec2-4daf-b1fb-2da25683229e"
}
]
}
(localcloud) π± > update virtualmachine id=d6c566f9-bec2-4daf-b1fb-2da25683229e cleanupextraconfig=true
{
"virtualmachine": {
"account": "admin",
"affinitygroup": [],
"arch": "x86_64",
"cpunumber": 1,
"cpuspeed": 500,
"cpuused": "14.36%",
"created": "2025-12-01T06:26:23+0000",
"deleteprotection": false,
"details": {
"cpuOvercommitRatio": "2.0"
},
"diskioread": 0,
"diskiowrite": 4,
"diskkbsread": 0,
"diskkbswrite": 24,
"displayname": "VM-d6c566f9-bec2-4daf-b1fb-2da25683229e",
"displayvm": true,
"domain": "ROOT",
"domainid": "82f87e9e-ce76-11f0-8a20-1e00060003cb",
"domainpath": "ROOT",
"guestosid": "83199135-ce76-11f0-8a20-1e00060003cb",
"haenable": false,
"hasannotations": false,
"hostcontrolstate": "Enabled",
"hostid": "5249cdbd-9ca9-4c00-a734-0537d89d0dbc",
"hostname": "pr11974-t14893-kvm-ol8-kvm1",
"hypervisor": "KVM",
"id": "d6c566f9-bec2-4daf-b1fb-2da25683229e",
"instancename": "i-2-3-VM",
"isdynamicallyscalable": false,
"lastupdated": "2025-12-01T06:26:37+0000",
"memory": 512,
"memoryintfreekbs": -1,
"memorykbs": 524288,
"memorytargetkbs": 524288,
"name": "VM-d6c566f9-bec2-4daf-b1fb-2da25683229e",
"networkkbsread": 0,
"networkkbswrite": 0,
"nic": [
{
"broadcasturi": "vlan://1262",
"deviceid": "0",
"extradhcpoption": [],
"id": "4c576998-3258-4f52-9df1-766315d8f14e",
"isdefault": true,
"isolationuri": "vlan://1262",
"macaddress": "02:01:00:cc:00:01",
"networkid": "882de96d-a74f-4131-814d-9d8e09119125",
"networkname": "test",
"secondaryip": [],
"traffictype": "Guest",
"type": "L2"
}
],
"osdisplayname": "CentOS 5.5 (64-bit)",
"ostypeid": "83199135-ce76-11f0-8a20-1e00060003cb",
"passwordenabled": false,
"pooltype": "NetworkFilesystem",
"receivedbytes": 0,
"rootdeviceid": 0,
"rootdevicetype": "ROOT",
"securitygroup": [],
"sentbytes": 0,
"serviceofferingid": "c049fc6b-1ff2-4ce5-a881-aaa26b9625e1",
"serviceofferingname": "Small Instance",
"state": "Running",
"tags": [],
"templatedisplaytext": "CentOS 5.5(64-bit) no GUI (KVM)",
"templateformat": "QCOW2",
"templateid": "82fe7d45-ce76-11f0-8a20-1e00060003cb",
"templatename": "CentOS 5.5(64-bit) no GUI (KVM)",
"templatetype": "BUILTIN",
"userid": "bea6206e-ce76-11f0-8a20-1e00060003cb",
"username": "admin",
"zoneid": "15d72fa5-8b47-4d90-b1c2-9e2c0d0b78e5",
"zonename": "pr11974-t14893-kvm-ol8"
}
}
(localcloud) π± > list virtualmachines id=d6c566f9-bec2-4daf-b1fb-2da25683229e filter=id,name,details
{
"count": 1,
"virtualmachine": [
{
"details": {
"cpuOvercommitRatio": "2.0"
},
"id": "d6c566f9-bec2-4daf-b1fb-2da25683229e",
"name": "VM-d6c566f9-bec2-4daf-b1fb-2da25683229e"
}
]
}
https://github.com/user-attachments/assets/23a834b1-f445-408d-98ec-86f51da7e67f
How did you try to break this feature and the system with this change?
Codecov Report
:x: Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 17.46%. Comparing base (db61470) to head (189f291).
:warning: Report is 15 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...he/cloudstack/api/command/user/vm/UpdateVMCmd.java | 0.00% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #11974 +/- ##
============================================
- Coverage 17.56% 17.46% -0.11%
+ Complexity 15548 15522 -26
============================================
Files 5913 5913
Lines 529440 529396 -44
Branches 64670 64671 +1
============================================
- Hits 93019 92464 -555
- Misses 425963 426513 +550
+ Partials 10458 10419 -39
| Flag | Coverage Ξ | |
|---|---|---|
| uitests | 3.58% <ΓΈ> (-0.01%) |
:arrow_down: |
| unittests | 18.52% <89.65%> (-0.12%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@blueorangutan package
@shwstppr 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]: βοΈ el8 βοΈ el9 βοΈ el10 βοΈ debian βοΈ suse15. SL-JID 15738
@blueorangutan package
@shwstppr 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]: βοΈ el8 βοΈ el9 βοΈ el10 βοΈ debian βοΈ suse15. SL-JID 15874
@blueorangutan package
@shwstppr 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]: βοΈ el8 βοΈ el9 βοΈ el10 βοΈ debian βοΈ suse15. SL-JID 15963