Bug 1148773
| Summary: | NPE when adding QoS object without type_ to datacenter | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Virtualization Manager | Reporter: | Meni Yakove <myakove> | ||||
| Component: | ovirt-engine-restapi | Assignee: | Juan Hernández <juan.hernandez> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Ilanit Stein <istein> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 3.5.0 | CC: | bazulay, dfediuck, ecohen, gklein, iheim, istein, lsurette, mavital, myakove, rbalakri, Rhev-m-bugs, sherold, yeylon | ||||
| Target Milestone: | --- | ||||||
| Target Release: | 3.5.0 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | sla | ||||||
| Fixed In Version: | org.ovirt.engine-root-3.5.0-14 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2015-02-17 17:11:06 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | SLA | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
Meni Yakove
2014-10-02 10:23:09 UTC
This happens because the presence of the mandatory "type" parameter isn't validated by the server, but the value is validated thus triggering a NPE. To fix the issue we need to validate the presence of the parameter and also make sure that the validation of the value takes into account that it can be null. this bug status was moved to MODIFIED before engine vt5 was built, hence moving to on_qa, if this was mistake and the fix isn't in, please contact rhev-integ Hi, Please provide exact steps for bug reproduction. In order to reproduce create and execute a Python script like this (copied from the description of the bug): #!/usr/bin/python from ovirtsdk.api import API from ovirtsdk.xml import params api = API( url="https://ovirt.example.com/ovirt-engine/api", username="admin@internal", password="******", insecure=True ) dc = api.datacenters.get("mydc") qos = params.QoS(name="myquos") dc.qoss.add(qos) The result of this should be an error message indicating that the "type" attribute is mandatory: status: 400 reason: Bad detail: QoS [type] required for add Modify the Python script so that it includes the type: qos = params.QoS(name="myquos", type_="storage") Then run it again. This time it should add the new QoS without errors. Tested on vt8 (rhevm-sdk-python-3.5.0.7-3.el6ev.noarch.rpm), using the script from comment #4. Looks as if fix is not included yet in this version. Got the same error, as in bug description: Traceback (most recent call last): File "bug_1148773.py", line 15, in <module> dc.qoss.add(qos) File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 7835, in add headers={"Expect":expect, "Correlation-Id":correlation_id} File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 88, in add return self.request('POST', url, body, headers) File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 118, in request persistent_auth=self._persistent_auth) File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 146, in __doRequest persistent_auth=persistent_auth File "/usr/lib/python2.6/site-packages/ovirtsdk/web/connection.py", line 134, in doRequest raise RequestError, response ovirtsdk.infrastructure.errors.RequestError: status: 400 reason: Bad Request detail: QoS [type] required for add Ilanit, did you add the "type_" parameter to the script? Should be like this:
qos = params.QoS(name="myquos", type_="storage")
Note the type_ parameter -> ^^^^^^^^^^^^^^
In case of type provided, like in comment #6, the qos object is added to the dataCenter, and there is no error. Moving to verified, as I now understand the output for not providing the mandatory type parameter, is as expected. rhev 3.5.0 was released. closing. |