Bug 1255848 - Error 500 and NPE when trying to import certificates of HTTP provider
Error 500 and NPE when trying to import certificates of HTTP provider
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine
Classification: oVirt
Component: RestAPI (Show other bugs)
---
Unspecified Unspecified
unspecified Severity high (vote)
: ovirt-3.6.0-rc
: 3.6.0
Assigned To: Juan Hernández
Ondra Machacek
infra
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-21 12:56 EDT by Juan Hernández
Modified: 2016-02-10 14:00 EST (History)
8 users (show)

See Also:
Fixed In Version: 3.6.0-11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-22 08:28:48 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
rule-engine: ovirt‑3.6.0+
ylavi: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)


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

  None (edit)
Description Juan Hernández 2015-08-21 12:56:42 EDT
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 12:59:13 EDT
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 06:37:59 EST
$ 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 08:28:48 EST
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.