Bug 1223482 - ovirtsdk.api.API.disks.add fails due to a server side java.lang.NullPointerException
Summary: ovirtsdk.api.API.disks.add fails due to a server side java.lang.NullPointerEx...
Keywords:
Status: CLOSED DUPLICATE of bug 1220824
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-api
Version: 3.6
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: m1
: 3.6.0
Assignee: Juan Hernández
QA Contact: Pavel Stehlik
URL:
Whiteboard: storage
Depends On: 1220824
Blocks: 1215623
TreeView+ depends on / blocked
 
Reported: 2015-05-20 15:44 UTC by Simone Tiraboschi
Modified: 2016-03-10 06:15 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-03 08:14:05 UTC
oVirt Team: Storage


Attachments (Terms of Use)
test snippet (884 bytes, text/plain)
2015-05-20 15:50 UTC, Simone Tiraboschi
no flags Details
Host and engineVM logs (254.84 KB, application/x-gzip)
2015-05-29 16:06 UTC, Simone Tiraboschi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1147860 0 unspecified CLOSED [Tracker] Exporting, moving and copying LUN disks and VM's LUN disks fail in the REST API 2021-02-22 00:41:40 UTC

Internal Links: 1147860

Description Simone Tiraboschi 2015-05-20 15:44:52 UTC
Description of problem:
ovirtsdk.api.API.disks.add fails due to a server side java.lang.NullPointerException

I simply get:
Traceback (most recent call last):
  File "test_1215623.py", line 41, in <module>
    engine_api.disks.add(disk)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 10650, in add
    headers={"Correlation-Id":correlation_id, "Expect":expect}
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 75, in add
    return self.request('POST', url, body, headers)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 115, in request
    persistent_auth=self.__persistent_auth
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 79, in do_request
    persistent_auth)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 154, in __do_request
    raise errors.RequestError(response_code, response_reason, response_body)
ovirtsdk.infrastructure.errors.RequestError: 
status: 500
reason: Internal
detail: HTTP Status 500

I cannot find anything under engine.log but under server.log I can find:

2015-05-20 17:22:14,659 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ovirt-engine/api].[org.ovirt.engine.api.restapi.BackendApplication]] (ajp--127.0.0.1-8702-5) Servlet.service() for servlet org.ovirt.engine.api.restapi.BackendApplication threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
	at 
...
...
...
Caused by: java.lang.NullPointerException
	at org.ovirt.engine.api.restapi.resource.BackendDisksResource.getStorageDomainById(BackendDisksResource.java:66) [restapi-jaxrs.jar:]
	at org.ovirt.engine.api.restapi.resource.BackendDisksResource.add(BackendDisksResource.java:38) [restapi-jaxrs.jar:]
...


The attached snippet is enough to trigger it.
The same snippet is working against 3.5.z

Version-Release number of selected component (if applicable):
ovirt-engine 3.6.0

How reproducible:
100%

Steps to Reproduce:
1. customize and run the attached snippet
2.
3.

Actual results:
It generates a
 ovirtsdk.infrastructure.errors.RequestError: 
 status: 500
 reason: Internal
 detail: HTTP Status 500
client side
and a java.lang.NullPointerException serverside

Expected results:
It works as in 3.5.z

Additional info:
It blocks hosted-engine on iSCSI and on FC

Comment 1 Simone Tiraboschi 2015-05-20 15:45:55 UTC
It's probably related to https://bugzilla.redhat.com/show_bug.cgi?id=1147860

Comment 2 Simone Tiraboschi 2015-05-20 15:50:06 UTC
Created attachment 1027781 [details]
test snippet

test_1223482.py

Comment 3 Juan Hernández 2015-05-20 16:05:58 UTC
This is a duplicate of bug 1220824, and has already been fixed:

  restapi: avoid npe on vm disk creation without domain
  https://gerrit.ovirt.org/40826

*** This bug has been marked as a duplicate of bug 1220824 ***

Comment 4 Simone Tiraboschi 2015-05-29 16:01:34 UTC
I tried it with ovirt-engine.noarch 3.6.0-0.0.master.20150528052151.git92dca0e.el7.centos  which should include patch 40826 for BZ#1220824 but the issue is still there.

On hosted-engine side I'm still getting:
2015-05-29 16:06:14 DEBUG otopi.plugins.ovirt_hosted_engine_setup.engine.add_disk add_disk._closeup:199 Cannot add the Hosted Engine VM Disk to the engine
Traceback (most recent call last):
  File "/usr/share/ovirt-hosted-engine-setup/scripts/../plugins/ovirt-hosted-engine-setup/engine/add_disk.py", line 195, in _closeup
    engine_api.disks.add(disk)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 10651, in add
    headers={"Correlation-Id":correlation_id, "Expect":expect}
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 75, in add
    return self.request('POST', url, body, headers)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 115, in request
    persistent_auth=self.__persistent_auth
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 79, in do_request
    persistent_auth)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 154, in __do_request
    raise errors.RequestError(response_code, response_reason, response_body)
RequestError: ^M
status: 500^M
reason: Internal^M
detail: HTTP Status 500
2015-05-29 16:06:14 ERROR otopi.plugins.ovirt_hosted_engine_setup.engine.add_disk add_disk._closeup:202 Cannot add the Hosted Engine VM Disk to the engine
2015-05-29 16:06:14 DEBUG otopi.context context._executeMethod:155 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 145, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-hosted-engine-setup/scripts/../plugins/ovirt-hosted-engine-setup/engine/add_disk.py", line 205, in _closeup
    _('Cannot add the Hosted Engine VM Disk to the engine')
RuntimeError: Cannot add the Hosted Engine VM Disk to the engine

The cause is that hosted-engine storage domain is not managed by the engine and probably we couldn't have it for 3.6.
Please see:
https://bugzilla.redhat.com/show_bug.cgi?id=1215158

But deploying hosted-engine-setup on iSCSI (and now also on FC), we still have to add the LUN were we deployed the engine VM as a direct LUN to prevent any other usages of that LUN which could destroy the engine itself.
Please see:
https://bugzilla.redhat.com/show_bug.cgi?id=1157243
https://bugzilla.redhat.com/show_bug.cgi?id=1157238

I'm attaching other logs.

Comment 5 Simone Tiraboschi 2015-05-29 16:06:43 UTC
Created attachment 1032183 [details]
Host and engineVM logs

Comment 6 Allon Mureinik 2015-06-03 07:24:47 UTC
There's too many comments here for me to understand what's going on.

Simone, can you provide simple steps to reproduce?
Thanks!

Comment 7 Simone Tiraboschi 2015-06-03 07:28:19 UTC
Hi Allon,
I already attached a test snippet to reproduce it.

By the way we had a new patch on 1220824 (still on post) which cold be enough to solve this one.

Comment 8 Simone Tiraboschi 2015-06-03 08:14:05 UTC

*** This bug has been marked as a duplicate of bug 1220824 ***


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