Skip to content

improved errorlog message by adding null check - #13263

Merged
RosiKyu merged 3 commits into
apache:mainfrom
saurabhkushwaha438:improved-errorlog-message
Nov 12, 2026
Merged

RosiKyu merged 3 commits into
apache:mainfrom
saurabhkushwaha438:improved-errorlog-message

Conversation

@saurabhkushwaha438

Copy link
Copy Markdown
Contributor

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:

  1. UnmanagedVMsManagerImpl.java

    • Added a null guard before invoking updateImportVMTaskErrorState(...) inside the CloudRuntimeException catch block.
  2. ImportVmTasksManagerImpl.java

    • Added an early return in updateImportVMTaskErrorState(...) when the provided task object is null.

These changes ensure that the original import/conversion failure (for example missing virt-v2v or nbdkit-vddk on the target KVM host) is preserved and propagated correctly to the UI instead of being hidden by a secondary NPE during task error handling.

@DaanHoogland
DaanHoogland requested review from Copilot and nvazquez and removed request for nvazquez May 27, 2026 13:07
@codecov

codecov Bot commented May 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.40%. Comparing base (d3f0700) to head (15c33ac).
⚠️ Report is 103 commits behind head on main.

Files with missing lines Patch % Lines
...apache/cloudstack/vm/ImportVmTasksManagerImpl.java 0.00% 21 Missing ⚠️
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     
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests 21.70% <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.

Copilot AI 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.

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.

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

@saurabhkushwaha438

Copy link
Copy Markdown
Contributor Author

@nvazquez , @DaanHoogland could you approve workflow and review pull request

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@saurabhkushwaha438

Copy link
Copy Markdown
Contributor Author

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!

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-16974)

@DaanHoogland

DaanHoogland commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

@saurabhkushwaha438 thanks for taking care of the conflicts. Could you answer the co-pilot's remaining remarks, please?

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@saurabhkushwaha438

Copy link
Copy Markdown
Contributor Author

@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

@nvazquez

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

blueorangutan commented Oct 24, 2026 •

Copy link
Copy Markdown

[SF] Trillian test result (tid-17235)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 57163 seconds
Marvin logs: [archive removed]
Smoke tests completed. 157 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@DaanHoogland DaanHoogland linked an issue Nov 8, 2026 that may be closed by this pull request

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

Code LGTM

@nvazquez

Copy link
Copy Markdown
Contributor

@blueorangutan package

@RosiKyu

RosiKyu commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

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

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.

@RosiKyu
RosiKyu merged commit a8200cf into apache:main Nov 12, 2026
23 of 27 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Done in CloudStack Testing Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

Ui : Improve the error log message

7 participants