Bug 1353460 - API: exception on engine while trying add an event via API (due to the use of cluster name. Workaround: use cluster ID)
Summary: API: exception on engine while trying add an event via API (due to the use of...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ovirt-4.0.2
: 4.0.2
Assignee: Juan Hernández
QA Contact: Lukas Svaty
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-07 07:42 UTC by Yaniv Kaul
Modified: 2016-07-28 10:30 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-07-28 10:30:43 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.0.z+
rule-engine: planning_ack+
juan.hernandez: devel_ack+
lsvaty: testing_ack+


Attachments (Terms of Use)
server.log (5.99 KB, application/x-gzip)
2016-07-07 07:45 UTC, Yaniv Kaul
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 60316 0 master MERGED restapi: Avoid NPE when external event has link but not id 2016-07-11 13:54:14 UTC
oVirt gerrit 60515 0 ovirt-engine-4.0 MERGED restapi: Avoid NPE when external event has link but not id 2016-07-11 14:39:26 UTC

Description Yaniv Kaul 2016-07-07 07:42:51 UTC
Description of problem:
When trying to add an events via the Python v3 SDK, I'm getting an exception in the backend.

Version-Release number of selected component (if applicable):
ovirt-engine-tools-backup-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-vmconsole-proxy-1.0.3-0.0.master.20160614081534.gitd1c5824.el7.noarch
ovirt-engine-backend-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-setup-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-dbscripts-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-extensions-api-impl-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
python-ovirt-engine-sdk4-4.0.0-0.3.a3.el7.centos.x86_64
ovirt-engine-wildfly-overlay-10.0.0-1.el7.noarch
ovirt-setup-lib-1.0.2-1.el7.centos.noarch
ovirt-engine-extension-aaa-ldap-1.2.2-0.0.master.20160629222654.git2afbeb2.el7.noarch
ovirt-engine-extension-aaa-jdbc-1.1.1-0.0.master.20160526092913.git2e68ef6.el7.noarch
ovirt-host-deploy-1.5.0-1.el7.centos.noarch
ovirt-engine-setup-plugin-ovirt-engine-common-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-setup-plugin-websocket-proxy-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-vmconsole-1.0.3-0.0.master.20160614081534.gitd1c5824.el7.noarch
ovirt-engine-dwh-4.1.0-0.0.master.20160706082926.el7.centos.noarch
ovirt-engine-webadmin-portal-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-tools-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-userportal-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-vmconsole-proxy-helper-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-setup-plugin-ovirt-engine-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-image-uploader-4.0.1-0.0.master.20160601214601.gitd6fd324.el7.centos.noarch
ovirt-engine-setup-base-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-cli-3.6.8.0-1.el7.centos.noarch
ovirt-engine-websocket-proxy-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-host-deploy-java-1.5.0-1.el7.centos.noarch
ovirt-engine-dwh-setup-4.1.0-0.0.master.20160706082926.el7.centos.noarch
ovirt-engine-dashboard-1.0.0-0.3.20160705gita75c8ef.el7.centos.noarch
ovirt-engine-restapi-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-setup-plugin-vmconsole-proxy-helper-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch
ovirt-engine-extension-aaa-ldap-setup-1.2.2-0.0.master.20160629222654.git2afbeb2.el7.noarch
ovirt-engine-sdk-python-3.6.8.0-1.el7.centos.noarch
ovirt-iso-uploader-4.0.1-0.0.master.20160531154203.git7213b00.el7.centos.noarch
ovirt-engine-wildfly-10.0.0-1.el7.x86_64
ovirt-engine-lib-4.1.0-0.0.master.20160706171333.git218f771.el7.centos.noarch

How reproducible:
Code:
@testlib.with_ovirt_api
def add_event(api):
    t = datetime.datetime.now()
    eventId = int(t.strftime("%s"))
    event_params = params.Event(
        description='ovirt-system-tests description',
        custom_id=eventId,
        severity='NORMAL',
        origin='ovirt-system-tests',
        cluster=params.Cluster(
            name=TEST_CLUSTER,
        ),
    )

    nt.assert_true(api.events.add(event_params))



Actual results:
2016-07-07 03:32:33,327 ERROR [io.undertow.request] (default task-31) UT005023: Exception handling request to /ovirt-engine/api/v3/events: java.lang.RuntimeException: org.jboss.resteasy.spi.UnhandledException: o
rg.ovirt.engine.api.restapi.utils.MappingException: java.lang.reflect.InvocationTargetException
        at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:217) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
        at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
        at org.ovirt.engine.api.restapi.invocation.VersionFilter.doFilter(VersionFilter.java:139) [restapi-jaxrs.jar:]
        at org.ovirt.engine.api.restapi.invocation.VersionFilter.doFilter(VersionFilter.java:68) [restapi-jaxrs.jar:]
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
        at org.ovirt.engine.api.restapi.invocation.CurrentFilter.doFilter(CurrentFilter.java:84) [restapi-jaxrs.jar:]
        at org.ovirt.engine.api.restapi.invocation.CurrentFilter.doFilter(CurrentFilter.java:63) [restapi-jaxrs.jar:]
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]


Expected results:
Event is being added.

Comment 1 Yaniv Kaul 2016-07-07 07:45:38 UTC
Created attachment 1177209 [details]
server.log

Comment 2 Juan Hernández 2016-07-07 08:00:27 UTC
This happens because we don't support specifying the cluster by name, only by id, but we don't validate that properly.

To make this work use the cluster id:

 cluster=params.Cluster(
   id=TEST_CLUSTER_ID,
 ),

As there is a workaround, I'm lowering the severity.

Note that this isn't specific to version 3 of the API, the same happens with version 4.

First thing we need to fix is stop assuming that the cluster id is present when the cluster is present. Doing that will mean that a request that uses the cluster name will succeed, but ignoring completely the name.

We can also improve the system so that it accepts the cluster name, but I think that should be a different bug, maybe an RFE.

Comment 3 Gil Klein 2016-07-28 10:30:43 UTC
This bug was fixed and is slated to be in the upcoming version. As we
are focusing our testing at this phase on severe bugs, this bug was
closed without going through its verification step. If you think this
bug should be verified by QE, please set its severity to high and move
it back to ON_QA


Note You need to log in before you can comment on or make changes to this bug.