Uh oh!
There was an error while loading. Please reload this page.
improved errorlog message by adding null check - #13263
improved errorlog message by adding null check#13263saurabhkushwaha438 wants to merge 4 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #13263 +/- ##
============================================
+ Coverage 18.11% 18.77% +0.66% - Complexity 16757 17989 +1232
============================================
Files 6037 6163 +126 Lines 542783 553008 +10225 Branches 66454 67387 +933 ============================================
+ Hits 98301 103837 +5536 - Misses 433438 437747 +4309 - Partials 11044 11424 +380
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.
| @Override | ||
| public void updateImportVMTaskErrorState(ImportVmTask importVMTask, ImportVmTask.TaskState state, String errorMsg) { | ||
| if (importVMTask == null) { |
Uh oh!
There was an error while loading. Please reload this page.
afeae99 to
5f54d85CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } catch (CloudRuntimeException e) { | ||
| logger.error(String.format("Error importing VM: %s", e.getMessage()), e); | ||
| importVmTasksManager.updateImportVMTaskErrorState(importVMTask, ImportVmTask.TaskState.Failed, e.getMessage()); | ||
| ActionEventUtils.onCompletedActionEvent(userId, owner.getId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_IMPORT, | ||
| cmd.getEventDescription(), null, null, 0); | ||
| importVmTasksManager.updateImportVMTaskErrorState(importVMTask, ImportVmTask.TaskState.Failed, | ||
| e.getMessage()); | ||
| ActionEventUtils.onCompletedActionEvent(userId, owner.getId(), EventVO.LEVEL_ERROR, | ||
| EventTypes.EVENT_VM_IMPORT, cmd.getEventDescription(), null, null, 0); | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); |
saurabhkushwaha438
commented
Jun 16, 2026
@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. |
saurabhkushwaha438
commented
Aug 7, 2026
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! |
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.