Bug 1541036 - Improving the error message of provisioning a VM via rest api with wrong vlan value
Summary: Improving the error message of provisioning a VM via rest api with wrong vlan...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
low
high
Target Milestone: GA
: 5.10.0
Assignee: Alona Kaplan
QA Contact: Radim Hrazdil
URL:
Whiteboard: api:rest:provisioning
: 1569247 (view as bug list)
Depends On:
Blocks: 1578393
TreeView+ depends on / blocked
 
Reported: 2018-02-01 15:03 UTC by Martin Kourim
Modified: 2021-09-09 13:07 UTC (History)
13 users (show)

Fixed In Version: 5.10.0.0
Doc Type: Bug Fix
Doc Text:
The examples part in the documentation should be updated. (https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.6/html/red_hat_cloudforms_rest_api/chap_examples) The 'vlan' field in the provision request should contain the id of the vnic profile the user wants to assign to the vnic. POST /api/provision_requests { .. "vm_fields" : { .. "vlan" : "9da9fcab-6d8f-4319-a3b8-571c4cc1bffd" }, .. }
Clone Of:
: 1578393 (view as bug list)
Environment:
Last Closed: 2018-11-20 19:30:18 UTC
Category: ---
Cloudforms Team: RHEVM
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ManageIQ manageiq pull 17306 0 None closed Changing the description of the 'vlan' field in provision/network 2020-06-15 09:43:46 UTC

Description Martin Kourim 2018-02-01 15:03:12 UTC
Created attachment 1389546 [details]
api.log

Description of problem:
When creating provision request on RHEV provider the REST request fails with
{
    "error": {
        "kind": "internal_server_error",
        "message": "Provision failed for the following reasons:\n'Network/Network' is required",
        "klass": "RuntimeError"
    }
}
status code: 500 Internal Server Error


Version-Release number of selected component (if applicable):
5.9.0.18, 5.9.0.19
Checked that the identical request works as expected on 5.9.0.16


How reproducible:
100%


Steps to Reproduce:

POST /api/provision_requests
{"additional_values": {"request_id": "1001"},
 "ems_custom_attributes": {},
 "miq_custom_attributes": {},
 "requester": {"auto_approve": false,
  "owner_email": "jdoe",
  "owner_first_name": "John",
  "owner_last_name": "Doe",
  "user_name": "admin"},
 "tags": {"cc": "001", "network_location": "Internal"},
 "template_fields": {"guid": "<template_guid>"},
 "version": "1.1",
 "vm_fields": {"number_of_cpus": 1,
  "provision_type": "native_clone",
  "vlan": "ovirtmgmt",
  "vm_memory": "2048",
  "vm_name": "test_rest_prov_B2qNFMMOuF"}}

Comment 4 Alona Kaplan 2018-02-06 12:45:13 UTC
The vlan field should contain the profile_id (taken from ovirt), '<Empty>' or '<Template>' values.
Please refer to https://bugzilla.redhat.com/1449157 doc text for more details.


I'm changing the bug to improving the error message in case of wrong value passed to the vlan field.
Removing the regression keyword and changing the priority.

Comment 5 Jan Zmeskal 2018-02-07 10:57:56 UTC
I believe as part of resolution of this bug, documentation should be changed. Firstly see 2.7.4 here:

https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.6-beta/html/red_hat_cloudforms_rest_api/chap_reference_guide#provision-requests-attribute-groups

Description of "vlan" attribute is "vLAN" while in fact it is vNIC profile ID now. 

Also attribute "vlan" has invalid value in all of the examples here:

https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.6-beta/html/red_hat_cloudforms_rest_api/chap_examples#sect_provisioning_requests

Comment 6 Dan Kenigsberg 2018-02-18 09:03:04 UTC
The bug is not a TestBlocker, nor a regression. I'm removing its blocker flag.

Comment 7 Alona Kaplan 2018-04-22 07:06:23 UTC
*** Bug 1569247 has been marked as a duplicate of this bug. ***

Comment 15 Satoe Imaishi 2018-05-30 20:11:30 UTC
https://github.com/ManageIQ/manageiq/pull/17495

Comment 16 Martin Kourim 2018-07-11 09:44:59 UTC
When wrong value is passed to the vlan field the error message is now
{
"error":{
"kind": "internal_server_error",
"message": "Provision failed for the following reasons:\n'Network/Virtual NIC Profile ID or Profile Name (Network Name)' is required",
"klass": "RuntimeError"
}
}

While the error is expected and the message makes sense, I'm wondering if "internal server error" with status code 500 is what we expect. In my opinion it should be status code 400 and "kind": "bad_request" as is the case for other requests with wrong values.

Comment 17 Radim Hrazdil 2018-09-18 09:59:40 UTC
I tend to agree with Martin's comment above. Please revise. Moving to ON_DEV.

Comment 19 Martin Perina 2018-10-19 14:29:14 UTC
Removing blocker flag, this bug is not a regression nor blocker, the behavior just changed between RHV versions.

Comment 20 Sudhir Mallamprabhakara 2018-11-20 19:30:18 UTC
Based of BZ1578393


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