Fix NPE during VM setup for pvlan#12781
Conversation
|
@blueorangutan package |
|
@sureshanaparti 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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #12781 +/- ##
============================================
- Coverage 17.61% 17.61% -0.01%
+ Complexity 15664 15662 -2
============================================
Files 5917 5917
Lines 531402 531413 +11
Branches 64971 64974 +3
============================================
- Hits 93596 93585 -11
- Misses 427252 427273 +21
- Partials 10554 10555 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes a NullPointerException during VM pvlan setup by guarding against missing NIC broadcast URI (and missing host).
Changes:
- Add null checks for
NicProfile/getBroadCastUri()before accessing URI scheme. - Compare pvlan scheme safely using a local
schemevariable and constant-first equals. - Add a host existence check (with a warning) before issuing the pvlan setup command.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 17068 |
|
@blueorangutan package |
|
@sureshanaparti 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 17091 |
|
@blueorangutan test |
|
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-15621)
|
|
Dear @sureshanaparti , what is the issue number that this PR relates to? |
@daviftorres , I don’t think there is an issue number linked as @sureshanaparti immediately started fixing an issue he saw. We can link any candidate issues retrospectively though. |
Dear @DaanHoogland, Panic shared this PR with me as a reference to a known issue we are experiencing in our production environment. However, the PR description does not clearly explain what problem it is resolving. That’s why I opened the issue, to get more clarity and additional context. |
Which issue # @davift ? |
Andrija Panic helped me on a ticket through ShapeBlue and he pointed that this PR fixed the issue we have encountered. But I cannot make my own assessment of the case based on the PR description. |
aha, Shapeblue does not publish customer issues (as I imagine others do not either). So for all sakes of argument there is no issue. They do often anonymise and create shadow issues for those and then we can refer them here, but we cannot link to “non-existent” issues. |
Pearl1594
left a comment
There was a problem hiding this comment.
Code lgtm - tested it, works as expected.
Description
This PR fixes NPE issue during VM setup for pvlan.
ERROR [c.c.v.VmWorkJobDispatcher] (Work-Job-Executor-5:[ctx-36c8ede2, job-51933/job-51934]) (logid:aad07025) Unable to complete AsyncJob {"accountId":2,"cmd":"com.cloud.vm.VmWorkMigrate","cmdInfo":"rO0ABXNyABpjb20uY2xvdWQudm0uVm1Xb3JrTWlncmF0ZRdxQXtPtzYqAgAGSgAJc3JjSG9zdElkTAAJY2x1c3RlcklkdAAQTGphdmEvbGFuZy9Mb25nO0wABmhvc3RJZHEAfgABTAAFcG9kSWRxAH4AAUwAB3N0b3JhZ2V0AA9MamF2YS91dGlsL01hcDtMAAZ6b25lSWRxAH4AAXhyABNjb20uY2xvdWQudm0uVm1Xb3Jrn5m2VvAlZ2sCAARKAAlhY2NvdW50SWRKAAZ1c2VySWRKAAR2bUlkTAALaGFuZGxlck5hbWV0ABJMamF2YS9sYW5nL1N0cmluZzt4cAAAAAAAAAACAAAAAAAAAFMAAAAAAAAAMHQAGVZpcnR1YWxNYWNoaW5lTWFuYWdlckltcGwAAAAAAAAAEXNyAA5qYXZhLmxhbmcuTG9uZzuL5JDMjyPfAgABSgAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAAAAAAA3NxAH4ABwAAAAAAAAATc3EAfgAHAAAAAAAAAAFwcQB-AAs","cmdVersion":0,"completeMsid":null,"created":"Mon Feb 16 15:40:04 EST 2026","id":51934,"initMsid":90520733277145,"instanceId":null,"instanceType":null,"lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":83,"uuid":"c3826ec3-3793-453c-bd0b-a79cbfbda7fe"}, job origin: 51933 java.lang.NullPointerException: Cannot invoke "java.net.URI.getScheme()" because the return value of "com.cloud.vm.NicProfile.getBroadCastUri()" is null at com.cloud.vm.UserVmManagerImpl.setupVmForPvlan(UserVmManagerImpl.java:5390) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at jdk.proxy3/jdk.proxy3.$Proxy219.setupVmForPvlan(Unknown Source) at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.prepareNicForMigration(NetworkOrchestrator.java:2278) at com.cloud.vm.VirtualMachineManagerImpl.migrate(VirtualMachineManagerImpl.java:3100) at com.cloud.vm.VirtualMachineManagerImpl.orchestrateMigrate(VirtualMachineManagerImpl.java:3052) at com.cloud.vm.VirtualMachineManagerImpl.orchestrateMigrate(VirtualMachineManagerImpl.java:5978)Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?