kvm: use preallocation option for fat disk resize
Description
Fixes #10589
Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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?
Preallocation flag added after changes,
2025-11-05 11:47:33,315 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Executing command [qemu-img create -o preallocation=full -f qcow2 /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 8589934592 ].
2025-11-05 11:49:07,780 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Successfully executed process [476300] for command [qemu-img create -o preallocation=full -f qcow2 /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 8589934592 ].
2025-11-05 11:49:07,781 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Executing command [qemu-img info -U /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 ].
2025-11-05 11:49:07,805 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Successfully executed process [476358] for command [qemu-img info -U /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 ].
2025-11-05 11:49:07,822 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Executing command [qemu-img convert -O qcow2 -o preallocation=full -U --image-opts driver=qcow2,file.filename=/mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/0abce4b6-b562-11f0-9bc2-1e008f00039b /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 ].
2025-11-05 11:50:49,386 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Successfully executed process [476361] for command [qemu-img convert -O qcow2 -o preallocation=full -U --image-opts driver=qcow2,file.filename=/mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/0abce4b6-b562-11f0-9bc2-1e008f00039b /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 ].
2025-11-05 11:50:49,387 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Executing command [qemu-img resize -o preallocation=full /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 10737418240 ].
2025-11-05 11:50:49,395 WARN [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Execution of process [476480] for command [qemu-img resize -o preallocation=full /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 10737418240 ] failed.
2025-11-05 11:50:49,395 DEBUG [utils.script.Script] (AgentRequest-Handler-4:[]) (logid:729511e8) Exit value of process [476480] for command [qemu-img resize -o preallocation=full /mnt/ea3a10a7-49cb-3d72-bcc3-dec41ebecb7a/6e320e64-0621-43f5-ac4c-9a0f60201f03 10737418240 ] is [1].
How did you try to break this feature and the system with this change?
Codecov Report
:x: Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 17.56%. Comparing base (671d8ad) to head (5934307).
:warning: Report is 20 commits behind head on 4.22.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...java/org/apache/cloudstack/utils/qemu/QemuImg.java | 0.00% | 32 Missing :warning: |
| .../hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 0.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## 4.22 #11986 +/- ##
=========================================
Coverage 17.55% 17.56%
- Complexity 15536 15551 +15
=========================================
Files 5909 5910 +1
Lines 529118 529147 +29
Branches 64627 64636 +9
=========================================
+ Hits 92902 92959 +57
+ Misses 425761 425731 -30
- Partials 10455 10457 +2
| Flag | Coverage Δ | |
|---|---|---|
| uitests | 3.58% <ø> (+<0.01%) |
:arrow_up: |
| unittests | 18.63% <0.00%> (+0.01%) |
:arrow_up: |
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 15650
@blueorangutan test
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
@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 15733
@blueorangutan test
@shwstppr a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
[SF] Trillian test result (tid-14814) Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8 Total time taken: 51042 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11986-t14814-kvm-ol8.zip Smoke tests completed. 149 look OK, 0 have errors, 0 did not run Only failed and skipped tests results shown below:
| Test | Result | Time (s) | Test File |
|---|
@blueorangutan test
@blueorangutan test
@RosiKyu a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
[SF] Trillian test result (tid-14971) Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8 Total time taken: 56810 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11986-t14971-kvm-ol8.zip Smoke tests completed. 135 look OK, 14 have errors, 0 did not run Only failed and skipped tests results shown below:
| Test | Result | Time (s) | Test File |
|---|---|---|---|
| test_DeployVmAntiAffinityGroup_in_project | Error |
69.38 | test_affinity_groups_projects.py |
| test_DeployVmAntiAffinityGroup | Error |
12.91 | test_affinity_groups.py |
| test_replace_acl_of_network | Error |
58.90 | test_global_acls.py |
| test_01_condensed_drs_algorithm | Error |
17.95 | test_cluster_drs.py |
| test_02_balanced_drs_algorithm | Error |
17.75 | test_cluster_drs.py |
| ContextSuite context=TestClusterDRS>:teardown | Error |
18.84 | test_cluster_drs.py |
| test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80 | Failure |
68.18 | test_internal_lb.py |
| test_04_rvpc_internallb_haproxy_stats_on_all_interfaces | Failure |
122.46 | test_internal_lb.py |
| test_updating_nics_on_two_shared_networks | Error |
10.94 | test_gateway_on_shared_networks.py |
| ContextSuite context=TestGatewayOnSharedNetwork>:teardown | Error |
13.13 | test_gateway_on_shared_networks.py |
| test_uservm_host_control_state | Failure |
16.85 | test_host_control_state.py |
| ContextSuite context=TestHostControlState>:teardown | Error |
32.46 | test_host_control_state.py |
| test_03_deploy_and_scale_kubernetes_cluster | Failure |
46.29 | test_kubernetes_clusters.py |
| test_08_upgrade_kubernetes_ha_cluster | Failure |
123.86 | test_kubernetes_clusters.py |
| test_12_test_deploy_cluster_different_offerings_per_node_type | Failure |
99.42 | test_kubernetes_clusters.py |
| test_01_non_strict_host_anti_affinity | Failure |
83.81 | test_nonstrict_affinity_group.py |
| test_02_non_strict_host_affinity | Error |
44.78 | test_nonstrict_affinity_group.py |
| test_02_L2_persistent_network | Failure |
1.95 | test_persistent_network.py |
| test_03_deploy_and_destroy_VM_and_verify_network_resources_persist | Failure |
19.50 | test_persistent_network.py |
| test_02_vpc_privategw_static_routes | Failure |
64.37 | test_privategw_acl.py |
| test_03_vpc_privategw_restart_vpc_cleanup | Failure |
64.11 | test_privategw_acl.py |
| test_04_rvpc_privategw_static_routes | Failure |
115.18 | test_privategw_acl.py |
| test_01_vpn_usage | Error |
1.09 | test_usage.py |
| test_05_deploy_vm_on_cluster_override_pod | Error |
7.44 | test_vm_deployment_planner.py |
| test_hostha_enable_ha_when_host_disabled | Error |
2.75 | test_hostha_kvm.py |
| test_hostha_enable_ha_when_host_in_maintenance | Error |
303.94 | test_hostha_kvm.py |
Thanks @RosiKyu for the tests. I've added the change to fix params
@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 ✖️ debian ✖️ suse15. SL-JID 16024
@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 16037
thanks @RosiKyu for testing!