-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix regression on create volume from snapshot #5282
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
Fix regression on create volume from snapshot #5282
Conversation
|
@GutoVeronezi a remark and a question; |
|
@DaanHoogland this is the full log of the error: The NPE does not appear in the stack trace because it's being hidden; Therefore I mapped the hierarchy to facilitate the comprehension:
Also, I added a commit to log the exception before throwing the About the remark, we choose to validate the |
nvazquez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, great catch @GutoVeronezi
| s_logger.error(message, e); | ||
| throw new CloudRuntimeException(message, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why log and throw? we can do with either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DaanHoogland as the real problem was not being logged, I thought it would be better to log it and keep the previous behavior.
What's your suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A CloudRuntimeException is caught and handled somewhere so I'd just throw. The logging will be hard to find and link to the proper occurrence. If the handling code doesn't log the exception than we should fix that. We potentially get the same stacktrace twice in the log now.
This is no 👎 by any means by the way. I'm just not so keen on overfilling the log with the same info multiple times, It's big enough as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fair, I will undo the last change.
As the focus of this PR is not the exception handling code, I think we should create an issue to investigate it.
|
good investigative work @GutoVeronezi , i have some preferences about the implementation (log when we do reorder and not when we don't) but the jist is, this is great. |
This reverts commit 70e6556.
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 785 |
|
@blueorangutan test |
|
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1518)
|
Description
PR #4640 added a condition validating if the VM is from hypervisor VMWare, in
AbstractStoragePoolAllocator::reorderPools(List<StoragePool>, VirtualMachineProfile, DeploymentPlan, DiskProfile).cloudstack/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
Lines 188 to 191 in 450de92
However, when creating a volume from a snapshot (without VM's id), ACS instantiates the VirtualMachineProfile without a VM:
cloudstack/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
Line 434 in 75a2c0b
Which cause a NPE on:
cloudstack/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
Line 188 in 450de92
The NPE is catch and throwed as a
CloudRuntimeException.This PR intends to add a validation if the VM is null before validating its hypervisor.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
It has been tested locally in a test lab.