Skip to content

KVM: fix host.volume.encryption always false with qemu-img >= 10.1 (help header changed)#13583

Closed
nikolauseppinger wants to merge 1 commit into
apache:mainfrom
nikolauseppinger:fix/kvm-qemuimg-luks-detection-qemu10.1
Closed

KVM: fix host.volume.encryption always false with qemu-img >= 10.1 (help header changed)#13583
nikolauseppinger wants to merge 1 commit into
apache:mainfrom
nikolauseppinger:fix/kvm-qemuimg-luks-detection-qemu10.1

Conversation

@nikolauseppinger

Copy link
Copy Markdown

Description

Fixes KVM volume encryption detection on hosts with qemu-img >= 10.1.0.

QEMU changed the qemu-img --help supported-formats header from
"Supported formats:" to "Supported image formats:" in 10.1.0. The detection
regex in QemuImg.helpSupportsImageFormat() no longer matched, so
hostSupportsVolumeEncryption() returned false and host.volume.encryption
was stored as false, blocking encrypted offerings on affected hosts (e.g.
RHEL 9.8 shipping qemu-img 10.1.0).

The regex now treats the "image" keyword as optional and is covered by unit
tests for both the legacy and the new header, plus a negative case.

Verified locally: full reactor build of plugins/hypervisors/kvm (checkstyle,
compile, testCompile, surefire) via Maven 3.8 / JDK 11 in Docker succeeds, and
a standalone JUnit run exercising helpSupportsImageFormat() directly against
both the legacy Supported formats: header and the new qemu-img 10.1.0
Supported image formats: header passes (3/3), confirming the fix is
backward compatible.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Bug Severity

  • Major

@boring-cyborg

boring-cyborg Bot commented Jul 10, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 19.47%. Comparing base (8996286) to head (cd1c427).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...java/org/apache/cloudstack/utils/qemu/QemuImg.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13583   +/-   ##
=========================================
  Coverage     19.47%   19.47%           
+ Complexity    19352    19351    -1     
=========================================
  Files          6294     6294           
  Lines        568164   568164           
  Branches      69600    69600           
=========================================
+ Hits         110664   110675   +11     
+ Misses       445422   445410   -12     
- Partials      12078    12079    +1     
Flag Coverage Δ
uitests 3.44% <ø> (ø)
unittests 20.73% <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 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.

@weizhouapache weizhouapache added this to the 4.23.0 milestone Jul 10, 2026
@weizhouapache

Copy link
Copy Markdown
Member

verified the command, it worked with both

Supported formats: blkdebug blklogwrites blkverify compress copy-before-write copy-on-read file ftp ftps host_cdrom host_device http https io_uring luks nbd null-aio null-co nvme nvme-io_uring preallocate qcow2 quorum raw rbd snapshot-access throttle vdi vhdx virtio-blk-vfio-pci virtio-blk-vhost-user virtio-blk-vhost-vdpa vmdk vpc

and

Supported image formats: blkdebug blklogwrites blkverify compress copy-before-write copy-on-read file ftp ftps host_cdrom host_device http https io_uring luks nbd null-aio null-co nvme nvme-io_uring preallocate qcow2 quorum raw rbd snapshot-access throttle vdi vhdx virtio-blk-vfio-pci virtio-blk-vhost-user virtio-blk-vhost-vdpa vmdk vpc

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no 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 18528

@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

@weizhouapache

Copy link
Copy Markdown
Member

@nikolauseppinger
can you rebase with 4.22 so that the fix will be included in next 4.22.2 LTS release ?

@weizhouapache weizhouapache modified the milestones: 4.23.0, 4.22.2 Jul 10, 2026
@weizhouapache

Copy link
Copy Markdown
Member

moving to 4.22.2 milestone

qemu-img 10.1.0 changed the "qemu-img --help" supported-formats header
from "Supported formats:" to "Supported image formats:". The regex in
QemuImg.helpSupportsImageFormat() only matched the old header, so
hostSupportsVolumeEncryption() returned false on affected hosts even
though cryptsetup and the luks format were both available, blocking
encrypted offerings.

Make the "image" keyword optional in the regex so it matches both the
legacy and current qemu-img help output.
@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File

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