Bug 1578393

Summary: Improving the error message of provisioning a VM via rest api with wrong vlan value
Product: Red Hat CloudForms Management Engine Reporter: Satoe Imaishi <simaishi>
Component: APIAssignee: Alona Kaplan <alkaplan>
Status: CLOSED ERRATA QA Contact: Martin Kourim <mkourim>
Severity: high Docs Contact:
Priority: low    
Version: 5.9.0CC: alkaplan, brant.evans, cpelland, dajohnso, danken, istein, jzmeskal, mperina, obarenbo, tuado
Target Milestone: GAKeywords: ZStream
Target Release: 5.9.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:rest:provisioning
Fixed In Version: 5.9.3.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1541036 Environment:
Last Closed: 2018-07-12 13:15:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: RHEVM Target Upstream Version:
Embargoed:
Bug Depends On: 1541036    
Bug Blocks: 1561041    

Comment 2 CFME Bot 2018-05-15 13:35:55 UTC
New commit detected on ManageIQ/manageiq/gaprindashvili:

https://github.com/ManageIQ/manageiq/commit/cfed918a101926ee63ede49932ecf018eeb6f434
commit cfed918a101926ee63ede49932ecf018eeb6f434
Author:     Adam Grare <agrare>
AuthorDate: Tue Apr 17 09:10:52 2018 -0400
Commit:     Adam Grare <agrare>
CommitDate: Tue Apr 17 09:10:52 2018 -0400

    Merge pull request #17306 from AlonaKaplan/vlan_description

    Changing the description of the 'vlan' field in provision/network
    (cherry picked from commit 9f7f72cdc7885ebb90a414411e6438a1b8576b8e)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1578393

 product/dialogs/miq_dialogs/miq_provision_redhat_dialogs_template.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 4 Ilanit Stein 2018-05-27 11:02:09 UTC
Tested on CFME-5.9.3/RHV-4.2.2.5

Running the VM provision request,
mentioned in the bug description (with "vlan" : "ovirtmgmt")
give now this error:

{
"error":{
"kind": "internal_server_error",
"message": "Provision failed for the following reasons:\n'Network/Virtual NIC Profile ID' is required",
"klass": "RuntimeError"
}
}

I think the naming is still confusing: 

The field name in the UI/REST api request is "vlan".
However,
for api version 3, "network" is expected,
for api version 4, "vnic_profile_id" is expected,

Can we change this field's name 
for api version 3, name it "network",
for api version 4, name it "vnic_profile_id",

and have the error contain the same name, used in the request: "network"/"vnic_profile_id"?

Thanks.

Comment 8 Alona Kaplan 2018-05-29 10:34:06 UTC
Hi Leo,

Bug https://bugzilla.redhat.com/1574351 handles the issue.

It will be possible to set the "profile_name (network_name)" instead of the profile id.

Comment 9 Ilanit Stein 2018-05-29 13:11:13 UTC
Alona,

After implementing https://bugzilla.redhat.com/1574351,

If a value for "vlan" will not be provided, or it's value will not be valid,
will the error still remain:

{
"error":{
"kind": "internal_server_error",
"message": "Provision failed for the following reasons:\n'Network/Virtual NIC Profile ID' is required",
"klass": "RuntimeError"
}
}

or will it change into something like

{
"error":{
"kind": "internal_server_error",
"message": "Provision failed for the following reasons:\n'Network/profile_name (network_name)' is required",
"klass": "RuntimeError"
}
}

Thanks.

Comment 10 Alona Kaplan 2018-05-30 07:57:27 UTC
Will change to -
"Provision failed for the following reasons:\n'Network/Virtual NIC Profile ID or 'profile_name (network_name)'".

Is it ok?

Comment 11 CFME Bot 2018-05-30 15:51:44 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/159e36074a874ca159ac5e0055f532c7f40bd380
commit 159e36074a874ca159ac5e0055f532c7f40bd380
Author:     Alona Kaplan <alkaplan>
AuthorDate: Wed May 30 07:38:36 2018 -0400
Commit:     Alona Kaplan <alkaplan>
CommitDate: Wed May 30 07:38:36 2018 -0400

    Adding the profile description option to the provision error message

    If the requested vlan/network is wrong, the error message will be-
    'Virtual NIC Profile ID or Profile Name (Network Name)'

    Fixes https://bugzilla.redhat.com/1578393
    Fixes https://bugzilla.redhat.com/1574351

 product/dialogs/miq_dialogs/miq_provision_redhat_dialogs_clone_to_vm.yaml | 1 +
 product/dialogs/miq_dialogs/miq_provision_redhat_dialogs_template.yaml | 3 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comment 12 CFME Bot 2018-05-30 20:16:36 UTC
New commit detected on ManageIQ/manageiq/gaprindashvili:

https://github.com/ManageIQ/manageiq/commit/fdd5b2e568e52042ccb233cff19b0dd08b3e5482
commit fdd5b2e568e52042ccb233cff19b0dd08b3e5482
Author:     Adam Grare <agrare>
AuthorDate: Wed May 30 11:49:19 2018 -0400
Commit:     Adam Grare <agrare>
CommitDate: Wed May 30 11:49:19 2018 -0400

    Merge pull request #17495 from AlonaKaplan/required_description

    Adding the profile description option to the provision error message
    (cherry picked from commit f27749569895ad0249877debf246bdfa2b5134c3)

    https://bugzilla.redhat.com/show_bug.cgi?id=1578393
    https://bugzilla.redhat.com/show_bug.cgi?id=1584406

 product/dialogs/miq_dialogs/miq_provision_redhat_dialogs_clone_to_vm.yaml | 1 +
 product/dialogs/miq_dialogs/miq_provision_redhat_dialogs_template.yaml | 3 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comment 13 Ilanit Stein 2018-06-07 11:42:24 UTC
Verified on cfme-5.9.3.1/RHV-4.2.3
Sent REST api request:

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"}}

This error is given:

{
"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"
}
}

This is the expected error.

It is not ideal error message, 
since the field in restapi body is called "vlan",
while the error refer to "Network",
but this is understandable, considering this field serve all providers,
and will require a cross platform change.

Comment 15 errata-xmlrpc 2018-07-12 13:15:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2184