Bug 1340607

Summary: NPE when listing VMs via REST
Product: [oVirt] ovirt-engine Reporter: Meni Yakove <myakove>
Component: BLL.StorageAssignee: Tal Nisan <tnisan>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: urgent Docs Contact:
Priority: high    
Version: 4.0.0CC: alkaplan, amureini, bugs, myakove, tnisan
Target Milestone: ovirt-4.0.0-rcKeywords: Automation, Regression
Target Release: 4.0.0Flags: rule-engine: ovirt-4.0.0+
rule-engine: blocker+
rule-engine: planning_ack+
tnisan: devel_ack+
rule-engine: testing_ack+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1342054 (view as bug list) Environment:
Last Closed: 2016-07-05 08:01:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1342054    
Attachments:
Description Flags
engine.log none

Description Meni Yakove 2016-05-28 17:14:21 UTC
Description of problem:
Via REST V3 when changing vNIC interface type the vNIC network is changed to ovirtmgmt.
When doing the same in REST V4 the network doesn't changed to ovirtmgmt.


Version-Release number of selected component (if applicable):
ovirt-engine-4.1.0-0.0.master.20160526111325.git538ad4f.el7.centos.noarch


Steps to Reproduce:
1. Attach vNIC to VM with network 'net-1' and type virtio
2. Unplug the network
3. Via REST (V3) send:
PUT to /ovirt-engine/api/vms/<vm_id>/nics/vnic_id
<nic>
    <interface>e1000</interface>
</nic>

Actual results:

Comment 1 Meni Yakove 2016-05-28 17:16:45 UTC
Created attachment 1162599 [details]
engine.log

Comment 2 Meni Yakove 2016-05-28 19:29:14 UTC
Same for:
<nic>
    <linked>false</linked>
</nic>


2016-05-28 22:28:16,054 ERROR [org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery] (default task-16) [] Query 'GetVmOvfByVmIdQuery' failed: null
2016-05-28 22:28:16,054 ERROR [org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery] (default task-16) [] Exception: java.lang.NullPointerException
        at org.ovirt.engine.core.utils.ovf.OvfWriter.buildDisk(OvfWriter.java:204) [utils.jar:]
        at org.ovirt.engine.core.utils.ovf.OvfManager.buildOvf(OvfManager.java:118) [utils.jar:]
        at org.ovirt.engine.core.utils.ovf.OvfManager.exportVm(OvfManager.java:29) [utils.jar:]
        at org.ovirt.engine.core.bll.storage.ovfstore.OvfHelper.buildMetadataDictionaryForVm(OvfHelper.java:107) [bll.jar:]
        at org.ovirt.engine.core.bll.storage.ovfstore.OvfHelper.generateOvfConfigurationForVm(OvfHelper.java:87) [bll.jar:]
        at org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery.generateOvfConfig(GetVmOvfByVmIdQuery.java:37) [bll.jar:]
        at org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery.executeQueryCommand(GetVmOvfByVmIdQuery.java:23) [bll.jar:]
        at org.ovirt.engine.core.bll.QueriesCommandBase.executeCommand(QueriesCommandBase.java:101) [bll.jar:]
        at org.ovirt.engine.core.dal.VdcCommandBase.execute(VdcCommandBase.java:33) [dal.jar:]
        at org.ovirt.engine.core.bll.Backend.runQueryImpl(Backend.java:559) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runQuery(Backend.java:530) [bll.jar:]
        at sun.reflect.GeneratedMethodAccessor90.invoke(Unknown Source) [:1.8.0_91]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_91]
        at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_91]

Comment 3 Meni Yakove 2016-05-29 06:54:13 UTC
Same for:
<nic>
    <plugged>false</plugged>
</nic>

On V3 when setting plugged 'false' the network changed to random one.

Comment 4 Red Hat Bugzilla Rules Engine 2016-05-29 09:37:44 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 5 Yevgeny Zaspitsky 2016-05-30 09:15:44 UTC
From the trace looks like a storage related issue.

Comment 6 Tal Nisan 2016-05-30 09:48:02 UTC
Could not reproduce with the steps above, can it be that the VM configuration is faulty to begin with?

Comment 7 Tal Nisan 2016-05-30 18:49:25 UTC
Let me make it ever more specific, was the VM given created from a template imported from an export domain?
If so it should have been solved by bug 1339686, if not please try to reproduce from today's nightly cause I could not reproduce on master.

Comment 8 Meni Yakove 2016-05-31 17:18:15 UTC
I will need to recreate the template right?

Comment 9 Tal Nisan 2016-05-31 18:59:11 UTC
Yes, if the template was created before the bug fix it will not work, so please try to recreate it and try again

Comment 10 Meni Yakove 2016-06-01 08:35:53 UTC
with ovirt-engine-4.1.0-0.0.master.20160531051228.git1647007.el7.centos.noarch
and after recreate the template and create VM from this template I still fail to:
<nic>
    <linked>false</linked>
</nic>

with PUT into ovirt-engine/api/vms/<vm_id>/nics/<nic_id>

2016-06-01 11:27:01,456 WARN  [org.ovirt.engine.core.bll.network.vm.UpdateVmInterfaceCommand] (default task-23) [nics_update_03deaab4-305f-4973] Validation of action 'UpdateVmInterface' fail
ed for user admin@internal-authz. Reasons: VAR__TYPE__INTERFACE,VAR__ACTION__UPDATE,ACTIVATE_DEACTIVATE_NETWORK_NOT_IN_VDS
2016-06-01 11:27:01,457 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-23) [] Operation Failed: [The Network does not exist on the host the VM is running
 on.
 Either add the Network to the Host or migrate the VM to a Host that has this Network.]
2016-06-01 11:27:41,892 INFO  [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-17) [] User admin@internal successfully logged in with scopes: ovirt-app-api ovirt-ext=token
-info:authz-search ovirt-ext=token-info:public-authz-search ovirt-ext=token-info:validate
2016-06-01 11:27:42,815 INFO  [org.ovirt.engine.core.bll.aaa.CreateUserSessionCommand] (default task-6) [69409ff0] Running command: CreateUserSessionCommand internal: false.
2016-06-01 11:27:42,905 INFO  [org.ovirt.engine.core.bll.aaa.LogoutSessionCommand] (default task-6) [451f05c7] Running command: LogoutSessionCommand internal: false.
2016-06-01 11:27:42,913 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-6) [451f05c7] Correlation ID: 451f05c7, Call Stack: null, Custom Event ID: 
-1, Message: User admin@internal-authz logged out.
2016-06-01 11:28:29,637 INFO  [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-2) [] User admin@internal successfully logged in with scopes: ovirt-app-api ovirt-ext=token-
info:authz-search ovirt-ext=token-info:public-authz-search ovirt-ext=token-info:validate
2016-06-01 11:28:29,715 INFO  [org.ovirt.engine.core.bll.aaa.CreateUserSessionCommand] (default task-24) [66d9deb5] Running command: CreateUserSessionCommand internal: false.
2016-06-01 11:28:30,614 ERROR [org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery] (default task-24) [] Query 'GetVmOvfByVmIdQuery' failed: null
2016-06-01 11:28:30,614 ERROR [org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery] (default task-24) [] Exception: java.lang.NullPointerException
        at org.ovirt.engine.core.utils.ovf.OvfWriter.buildDisk(OvfWriter.java:204) [utils.jar:]
        at org.ovirt.engine.core.utils.ovf.OvfManager.buildOvf(OvfManager.java:118) [utils.jar:]
        at org.ovirt.engine.core.utils.ovf.OvfManager.exportVm(OvfManager.java:29) [utils.jar:]
        at org.ovirt.engine.core.bll.storage.ovfstore.OvfHelper.buildMetadataDictionaryForVm(OvfHelper.java:107) [bll.jar:]
        at org.ovirt.engine.core.bll.storage.ovfstore.OvfHelper.generateOvfConfigurationForVm(OvfHelper.java:87) [bll.jar:]
        at org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery.generateOvfConfig(GetVmOvfByVmIdQuery.java:37) [bll.jar:]
        at org.ovirt.engine.core.bll.GetVmOvfByVmIdQuery.executeQueryCommand(GetVmOvfByVmIdQuery.java:23) [bll.jar:]
        at org.ovirt.engine.core.bll.QueriesCommandBase.executeCommand(QueriesCommandBase.java:101) [bll.jar:]
        at org.ovirt.engine.core.dal.VdcCommandBase.execute(VdcCommandBase.java:33) [dal.jar:]
        at org.ovirt.engine.core.bll.Backend.runQueryImpl(Backend.java:559) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runQuery(Backend.java:530) [bll.jar:]
        at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source) [:1.8.0_91]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_91]
        at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_91]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

Comment 11 Tal Nisan 2016-06-01 13:30:32 UTC
Problem was with the population of the links that invoked GetVmOvfByVmIdQuery, this also happens upon listing of the VMs or a single VM.

Comment 12 Meni Yakove 2016-06-02 10:42:18 UTC
In the latest nightly the GetVmOvfByVmIdQuery NPE is gone.
Now the issue is when calling on V3 :
<nic>
  <linked>false</linked>
</nic>

The vNIC network is changed to random one
Same for 'linked'
So it's probably Network issue and not storage.

Comment 13 Aharon Canan 2016-06-08 11:47:25 UTC
(In reply to Meni Yakove from comment #12)
> In the latest nightly the GetVmOvfByVmIdQuery NPE is gone.
> Now the issue is when calling on V3 :
> <nic>
>   <linked>false</linked>
> </nic>
> 
> The vNIC network is changed to random one
> Same for 'linked'
> So it's probably Network issue and not storage.

Still exist ? if so we should reopen...

Comment 14 Tal Nisan 2016-06-08 12:03:50 UTC
The issue this bug handle is only the NPE while listing disks via REST, as for the network issue listed here which was masked by the NPE a network bug was openeed - BZ 1342054

Comment 15 Raz Tamir 2016-06-15 14:48:06 UTC
Verified on ovirt-engine-4.0.0.4-0.1.el7ev.noarch

Sent GET request to /api/vms --> no NPE in logs
Sent GET request to /api/disks --> no NPE in logs
Sent GET request to /api/nics --> no NPE in logs

Comment 16 Sandro Bonazzola 2016-07-05 08:01:40 UTC
oVirt 4.0.0 has been released, closing current release.