Bug 1255848 - Error 500 and NPE when trying to import certificates of HTTP provider
Summary: Error 500 and NPE when trying to import certificates of HTTP provider
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: ---
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Juan Hernández
QA Contact: Ondra Machacek
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-21 16:56 UTC by Juan Hernández
Modified: 2016-02-10 19:00 UTC (History)
8 users (show)

Fixed In Version: 3.6.0-11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-22 13:28:48 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-3.6.0+
ylavi: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 45192 0 master MERGED core, restapi: Avoid NPE when there are no provider certificates Never
oVirt gerrit 45237 0 ovirt-engine-3.6 MERGED core, restapi: Avoid NPE when there are no provider certificates Never

Description Juan Hernández 2015-08-21 16:56:42 UTC
This issue has been reported by Alexander Wells as part of the results of the test day. Quoting him:

	* Openstack volume provider. Everything worked as advertised as well, 
with the exception of 'importcertificates' that produced a 500 response. I get 
a feeling its because of my setup, where my connection to openstack was over 
http instead of https causing the problem. I would expect a better error 
message than a 500 though.
	* Openstack network provider. Same result as above, everything worked 
except for importcertificates.
	* Openstack image provider. Same result as above, everything worked 
except for importcertificates. This includes the public ovirt glance instance. 
it worked, with the exception of the importcertificates.

Comment 1 Juan Hernández 2015-08-21 16:59:13 UTC
The reason for this is that when the protocol used is HTTP the backend returns null instead of an empty list of certificates. The RESTAPI doesn't take this into account and tries to access the list to get its size, which triggers the NPE and then the 500 response code.

The fix for this is changing the RESTAPI so it will tolerate that null, and return the error message generated by the backend instead of a 500 respose code.

Comment 2 Ondra Machacek 2015-12-10 11:37:59 UTC
$ curl -k -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -H "Filter: $filter" \
    -d "<action><async>false</async><certificates><certificate>
    <content>
    ....
    </content>
    </certificate></certificates></action>" \
    -u $U $URL/openstackimageproviders/8b5452b2-695d-48b4-ae90-94486add1955/importcertificates

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action>
    <status>
        <state>complete</state>
    </status>
</action>

Comment 3 Sandro Bonazzola 2015-12-22 13:28:48 UTC
oVirt 3.6.0 has been released and the bz verified, moving to closed current release.


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