Repository navigation
improved errorlog message by adding null check - #13263
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13263 +/- ##
=========================================
Coverage 20.39% 20.40%
- Complexity 21283 21284 +1
=========================================
Files 6481 6481
Lines 588040 588049 +9
Branches 72021 72021
=========================================
+ Hits 119957 119978 +21
+ Misses 455052 455042 -10
+ Partials 13031 13029 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR prevents secondary NullPointerExceptions from masking the original VM import/conversion failure during VMware-to-KVM migration, so the UI/API can surface the real error (e.g., missing virt-v2v / nbdkit-vddk) as described in issue #13007.
Changes:
- Add a null guard before calling
updateImportVMTaskErrorState(...)from the VM import failure handler. - Add an early return in
updateImportVMTaskErrorState(...)when the provided task is null.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java | Avoids triggering a secondary NPE while handling a CloudRuntimeException during import. |
| server/src/main/java/org/apache/cloudstack/vm/ImportVmTasksManagerImpl.java | Makes task error-state updates resilient to null task objects. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
afeae99 to
5f54d85
Compare
|
@nvazquez , @DaanHoogland could you approve workflow and review pull request |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
Hi @nvazquez , I've resolved the merge conflicts and updated this PR with the latest main. The CI has been rerun. I'd appreciate a review whenever you have time. Thank you! |
|
@blueorangutan package |
|
@borisstoyanov 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19217 |
|
@blueorangutan test |
|
@borisstoyanov a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-16974) |
719f731 to
15c33ac
Compare
|
@saurabhkushwaha438 thanks for taking care of the conflicts. Could you answer the co-pilot's remaining remarks, please? |
|
@blueorangutan package |
|
@DaanHoogland 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19630 |
|
@DaanHoogland i have resolved the remaining conversation . also do i need to add unit tests for ImportVmTasksManagerImpl so that will fix codecov/patch and Sonar JaCoCo Coverage |
|
@blueorangutan test |
|
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-17235)
|
|
@blueorangutan package |
|
@blueorangutan package |
|
@RosiKyu 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20020 |
RosiKyu
left a comment
There was a problem hiding this comment.
LGTM
Tested on a KVM env (mgmt + 2 EL9 KVM hosts), baseline on current main build first, then the PR build (24.0.0-shapeblue22166).
- importVm VMware to KVM on a host without virt-v2v/nbdkit-vddk (the #13007 case): real error shown, no NPE. Note: same result on main already, because the caller has had the
if (importVMTask != null)guard since #13656/#14256, so the new check in updateImportVMTaskErrorState is an extra safety net. - importVm with usevddk=false against an unreachable vCenter (task created, then fails): real error returned, task saved as Failed with the error.
- Debug log fix confirmed. Main: "VM: qa-src-vm ... vCenter: qa13263-base2 / datacenter: 10.0.99.99 / source VM: qa-dc" (shifted). PR: "VM: qa13263-pr2 ... vCenter: 10.0.99.99 / datacenter: qa-dc / source VM: qa-src-vm" (correct).
- Regression: listImportVMTasks with failed/running/completed filters OK, invalid filter returns "Invalid value for task state", hosts Up, VM stop/start OK.
Implemented defensive null checks to prevent secondary NullPointerExceptions from masking the original VM import failure reason during VMware-to-KVM migration. for issue #13007
Changes made:
UnmanagedVMsManagerImpl.javaupdateImportVMTaskErrorState(...)inside theCloudRuntimeExceptioncatch block.ImportVmTasksManagerImpl.javaupdateImportVMTaskErrorState(...)when the provided task object is null.These changes ensure that the original import/conversion failure (for example missing
virt-v2vornbdkit-vddkon the target KVM host) is preserved and propagated correctly to the UI instead of being hidden by a secondary NPE during task error handling.