Skip to content

fail template creation when qemu-img or cp fails in createtmplt.sh - #14859

Open
Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:kvm-createtmplt-exit-code
Open

Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:kvm-createtmplt-exit-code

Conversation

@Damans227

Copy link
Copy Markdown
Collaborator

Fixes #14858

When qemu-img fails while creating a template from a volume on KVM, createtmplt.sh still exits 0, so CloudStack marks an empty template Ready. This checks the result of qemu-img convert and cp in create_from_file and exits 4 when they fail, like create_from_snapshot already does.

Test:

Run the script against a block device that fails every read (dmsetup create fix6err --table "0 2097152 error"), on a KVM host with qemu-img 8.2.2.

Before: exit 0, empty template and template.properties written.

qemu-img: error while reading at byte 8388608: Input/output error
exit=0
virtual size: 1 GiB (1073741824 bytes)
disk size: 196 KiB
/tmp/fix6/stock/template.properties

After: exit 4, no template.properties.

qemu-img: error while reading at byte 8388608: Input/output error
Failed to create template /tmp/fix6/fixed/t.qcow2 from /dev/mapper/fix6err
exit=4
no template.properties written

before-after

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.33%. Comparing base (6489766) to head (cada917).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14859      +/-   ##
============================================
- Coverage     18.34%   18.33%   -0.01%     
+ Complexity    16669    16665       -4     
============================================
  Files          5939     5939              
  Lines        537819   537819              
  Branches      65941    65941              
============================================
- Hits          98638    98630       -8     
- Misses       427960   427969       +9     
+ Partials      11221    11220       -1     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.43% <ø> (-0.01%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

@Damans227
Damans227 marked this pull request as ready for review November 25, 2026 18:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant