Skip to content

kvm: use preallocation option for fat disk resize - #11986

Merged
DaanHoogland merged 4 commits into
apache:4.22from
shapeblue:fix-fatdisk-resize
Dec 17, 2025
Merged

kvm: use preallocation option for fat disk resize#11986
DaanHoogland merged 4 commits into
apache:4.22from
shapeblue:fix-fatdisk-resize

Conversation

@shwstppr

@shwstpprshwstppr commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

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)
  • 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

codecovBot commented Nov 5, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.56%. Comparing base (671d8ad) to head (5934307).
⚠️ Report is 31 commits behind head on 4.22.

Files with missing linesPatch %Lines
...java/org/apache/cloudstack/utils/qemu/QemuImg.java0.00%32 Missing ⚠️
.../hypervisor/kvm/storage/LibvirtStorageAdaptor.java0.00%1 Missing ⚠️
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 
FlagCoverage Δ
uitests3.58% <ø> (+<0.01%)⬆️
unittests18.63% <0.00%> (+0.01%)⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shwstpprshwstppr closed this Nov 6, 2025
@shwstppr
shwstppr marked this pull request as ready for review November 6, 2025 08:53
@shwstpprshwstppr reopened this Nov 6, 2025
@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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.

@weizhouapacheweizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

not tested

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15650

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@shwstpprshwstppr closed this Nov 6, 2025
@shwstpprshwstppr reopened this Nov 6, 2025

@DaanHooglandDaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

Fixesapache#10589
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@RosiKyuRosiKyu removed their assignment Dec 12, 2025
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

Copy link
Copy Markdown
ContributorAuthor

Thanks @RosiKyu for the tests. I've added the change to fix params

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 16024

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16037

@RosiKyuRosiKyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Disk is fully preallocated as expected.

[root@ref-trl-10404-k-Mol9-rositsa-kyuchukova-kvm1 ~]# grep "415f694d-49f0-4bb6-b188-e95397dbc334" /var/log/cloudstack/agent/agent.log | grep "qemu-img"
2025-12-15 14:57:10,767 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Executing command [qemu-img create -o preallocation=full -f qcow2 /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 10737418240 ].
2025-12-15 14:58:28,079 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Successfully executed process [31759] for command [qemu-img create -o preallocation=full -f qcow2 /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 10737418240 ].
2025-12-15 14:58:28,081 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Executing command [qemu-img info -U /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 ].
2025-12-15 14:58:28,108 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Successfully executed process [31790] for command [qemu-img info -U /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 ].
2025-12-15 14:58:28,115 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Executing command [qemu-img convert -O qcow2 -o preallocation=full -U --image-opts driver=qcow2,file.filename=/mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/8d81fd6f-5aed-4993-af36-a16d0a7e61b9 /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 ].
2025-12-15 14:59:51,906 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Successfully executed process [31793] for command [qemu-img convert -O qcow2 -o preallocation=full -U --image-opts driver=qcow2,file.filename=/mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/8d81fd6f-5aed-4993-af36-a16d0a7e61b9 /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 ].
2025-12-15 14:59:51,907 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Executing command [qemu-img resize --preallocation=full /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 10737418240 ].
2025-12-15 14:59:52,026 WARN [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Execution of process [31853] for command [qemu-img resize --preallocation=full /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 10737418240 ] failed.
2025-12-15 14:59:52,026 DEBUG [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Exit value of process [31853] for command [qemu-img resize --preallocation=full /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 10737418240 ] is [1].
2025-12-15 14:59:52,026 WARN [utils.script.Script] (AgentRequest-Handler-1:[]) (logid:96111c19) Process [31853] for command [qemu-img resize --preallocation=full /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334 10737418240 ] encountered the error: [qemu-img: Preallocation can only be used for growing images].
[root@ref-trl-10404-k-Mol9-rositsa-kyuchukova-kvm1 ~]# ls -lsh /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334
12G -rw-r--r--. 1 root root 11G Dec 15 15:07 /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334
[root@ref-trl-10404-k-Mol9-rositsa-kyuchukova-kvm1 ~]# [root@ref-trl-10404-k-Mol9-rositsa-kyuchukova-kvm1 ~]# [root@ref-trl-10404-k-Mol9-rositsa-kyuchukova-kvm1 ~]# qemu-img info -U /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334
image: /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 11 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false
Child node '/file':
filename: /mnt/4680c43f-b2ce-3c6f-887e-9a923b277f01/415f694d-49f0-4bb6-b188-e95397dbc334
protocol type: file
file length: 10 GiB (10739318784 bytes)
disk size: 11 GiB

@weizhouapache

Copy link
Copy Markdown
Member

thanks @RosiKyu for testing!

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-14998)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 54178 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11986-t14998-kvm-ol8.zip
Smoke tests completed. 148 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_03_deploy_and_scale_kubernetes_clusterFailure25.62test_kubernetes_clusters.py

@DaanHoogland

Copy link
Copy Markdown
Contributor

@shwstppr , can you look at the remaining regression test failure. The title suggests it is related.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@shwstppr , can you look at the remaining regression test failure. The title suggests it is related.

maybe not but, it is also in #11962 (comment) (definately not related.

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@DaanHoogland looked into the test logs, failure is not related,

jobresult : {errorcode : 530, errortext : "Resource limits prevent scaling the cluster: Maximum amount of resources of Type = \'cpu\', tag = \'null\' for Account Name = test-a-TestKubernetesCluster-LKO3MF in Domain Id = 1 is exceeded: Account Resource Limit = 40, Current Account Resource Amount = 4, Current Account Resource Reservation = 0, Requested Resource Amount = 2000."}

@DaanHoogland
DaanHoogland merged commit e08e66d into apache:4.22Dec 17, 2025
24 of 27 checks passed
@DaanHoogland
DaanHoogland deleted the fix-fatdisk-resize branch December 17, 2025 12:03
DaanHoogland pushed a commit that referenced this pull request Dec 22, 2025
* 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)
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jan 21, 2026
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
sandeeplocharla pushed a commit to NetApp/cloudstack that referenced this pull request Feb 6, 2026
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Image resize for fat type of disk does not preallocate additional space

7 participants

@shwstppr@blueorangutan@weizhouapache@RosiKyu@DaanHoogland@rajujith@sureshanaparti