Skip to content

kvm: fix vm deployment from RAW template #10880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2025

Conversation

weizhouapache
Copy link
Member

Description

This PR fixes the vm deployment if template is RAW.

2025-05-16T09:32:39,205 ERROR [kvm.storage.LibvirtStorageAdaptor] (AgentRequest-Handler-2:[]) (logid:9d528179) Failed to convert [/mnt/71c96d7c-9e42-5184-83e3-0786cfa3e7d2/34cbcd76-aafb-53a9-9ad3-1596ce9389ff.raw] to [/mnt/db98865f-20d0-30d8-bcad-bec75452cb56/e1eceab0-863a-46c2-b0a2-100a2fbf3d09] due to: [qemu-img: Source lacks bitmap support]. org.apache.cloudstack.utils.qemu.QemuImgException: qemu-img: Source lacks bitmap support
        at org.apache.cloudstack.utils.qemu.QemuImg.convert(QemuImg.java:477)
        at com.cloud.hypervisor.kvm.storage.LibvirtStorageAdaptor.copyPhysicalDisk(LibvirtStorageAdaptor.java:1613)
        at com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager.copyPhysicalDisk(KVMStoragePoolManager.java:459)

RAW does not support bitmaps.

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?

How did you try to break this feature and the system with this change?

@weizhouapache
Copy link
Member Author

related to #9270
this might not be the best solution, but it just works.

it fixes the smoke test failures

image

cc @JoaoJandre @DaanHoogland @Pearl1594

@weizhouapache
Copy link
Member Author

@blueorangutan package

Copy link

codecov bot commented May 16, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 16.39%. Comparing base (64828f6) to head (9905760).
Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
.../hypervisor/kvm/storage/LibvirtStorageAdaptor.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10880      +/-   ##
============================================
- Coverage     16.40%   16.39%   -0.02%     
+ Complexity    13630    13626       -4     
============================================
  Files          5705     5708       +3     
  Lines        503722   504063     +341     
  Branches      61034    61103      +69     
============================================
+ Hits          82647    82651       +4     
- Misses       411889   412214     +325     
- Partials       9186     9198      +12     
Flag Coverage Δ
uitests 3.99% <ø> (ø)
unittests 17.25% <0.00%> (-0.02%) ⬇️

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.

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

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

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

Copy link
Contributor

@JoaoJandre JoaoJandre left a comment

Choose a reason for hiding this comment

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

Good catch @weizhouapache !

…/storage/LibvirtStorageAdaptor.java

Co-authored-by: João Jandre <[email protected]>
@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

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

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

@weizhouapache
Copy link
Member Author

@blueorangutan test

@blueorangutan
Copy link

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

@rohityadavcloud rohityadavcloud added this to the 4.21.0 milestone May 16, 2025
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

code ltgm

@weizhouapache weizhouapache marked this pull request as ready for review May 16, 2025 14:16
@DaanHoogland
Copy link
Contributor

@weizhouapache is this worth a smoke test?

@weizhouapache
Copy link
Member Author

@weizhouapache is this worth a smoke test?

yes, test_network failed as it uses ubuntu 22 cloud image which is raw format.

@JoaoJandre
Copy link
Contributor

Hey @weizhouapache I randomly stumbled upon another bug on the convert using --bitmaps. I'm still investigating how to best fix it, but I believe that we could add the fix in this PR, as it is in the same workflow. I'll try to get back to this on monday.

@blueorangutan
Copy link

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

Test Result Time (s) Test File
test_04_extract_Iso Failure 1.12 test_iso.py
test_03_ping_in_ssvm_success Failure 15.57 test_diagnostics.py
test_05_ping_in_cpvm_success Failure 15.53 test_diagnostics.py

@weizhouapache
Copy link
Member Author

Hey @weizhouapache I randomly stumbled upon another bug on the convert using --bitmaps. I'm still investigating how to best fix it, but I believe that we could add the fix in this PR, as it is in the same workflow. I'll try to get back to this on monday.

thanks @JoaoJandre

@JoaoJandre
Copy link
Contributor

@weizhouapache so the bug I had found was when using very old images, they would not support bitmaps and the copy process would throw me this error:

Failed to convert [/mnt/b59eff0f-5b97-37ed-a513-9e1983d1d19b/2784ec51-4776-4b03-9a85-198c465e7d25] to [/mnt/a66f48f5-13c6-3676-b320-a15d32bbf32f/2784ec51-4776-4b03-9a85-198c465e7d25] due to: [qemu-img: Source lacks bitmap support]. org.apache.cloudstack.utils.qemu.QemuImgException: qemu-img: Source lacks bitmap support

Looking at the Qemu-img source code (see https://github.com/qemu/qemu/blob/master/block/qcow2-bitmap.c#L1767), this error is thrown when the IMG version is lower then 3. So I've added a check to verify it before adding the --bitmaps option: version.txt (I can't upload .patch files due to a github bug apparently)

@weizhouapache
Copy link
Member Author

@weizhouapache so the bug I had found was when using very old images, they would not support bitmaps and the copy process would throw me this error:

Failed to convert [/mnt/b59eff0f-5b97-37ed-a513-9e1983d1d19b/2784ec51-4776-4b03-9a85-198c465e7d25] to [/mnt/a66f48f5-13c6-3676-b320-a15d32bbf32f/2784ec51-4776-4b03-9a85-198c465e7d25] due to: [qemu-img: Source lacks bitmap support]. org.apache.cloudstack.utils.qemu.QemuImgException: qemu-img: Source lacks bitmap support

Looking at the Qemu-img source code (see https://github.com/qemu/qemu/blob/master/block/qcow2-bitmap.c#L1767), this error is thrown when the IMG version is lower then 3. So I've added a check to verify it before adding the --bitmaps option: version.txt (I can't upload .patch files due to a github bug apparently)

@JoaoJandre
Good finding. Maybe we can merge this PR (if it is still needed ), then you create another PR for your changes ?

@JoaoJandre
Copy link
Contributor

@weizhouapache so the bug I had found was when using very old images, they would not support bitmaps and the copy process would throw me this error:

Failed to convert [/mnt/b59eff0f-5b97-37ed-a513-9e1983d1d19b/2784ec51-4776-4b03-9a85-198c465e7d25] to [/mnt/a66f48f5-13c6-3676-b320-a15d32bbf32f/2784ec51-4776-4b03-9a85-198c465e7d25] due to: [qemu-img: Source lacks bitmap support]. org.apache.cloudstack.utils.qemu.QemuImgException: qemu-img: Source lacks bitmap support

Looking at the Qemu-img source code (see https://github.com/qemu/qemu/blob/master/block/qcow2-bitmap.c#L1767), this error is thrown when the IMG version is lower then 3. So I've added a check to verify it before adding the --bitmaps option: version.txt (I can't upload .patch files due to a github bug apparently)

@JoaoJandre Good finding. Maybe we can merge this PR (if it is still needed ), then you create another PR for your changes ?

If you want to leave both contexts separated, I'm ok with it. I'll open a PR with the patch once this PR is merged.

@weizhouapache
Copy link
Member Author

the smoke test test_network uses template with RAW format.
It passed in last trillian test, which proved this PR worked.

merging

@weizhouapache weizhouapache merged commit 96b8e23 into apache:main May 19, 2025
21 of 26 checks passed
@DaanHoogland DaanHoogland deleted the 4.21-fix-kvm-raw-template branch May 20, 2025 06:43
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.

5 participants