Folsom - Exception message for "Create Flavor" with invalid Flavor ID is not consistent and proper

Bug #1056935 reported by Rajalakshmi Ganesan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Low
Sathish Nagappan

Bug Description

Description:
--------------

Exception message for "Create Flavor" with invalid Flavor ID is not Clear.

Environment:
--------------
Folsom

Actual Exception message:
------------------------------

Message from API: "message": "Malformed request body"
Message from Python Client: ERROR: invalid literal for int() with base 10: '2gjhffg'

Expected Exception Message:
----------------------------------

Should be something like(When Flavor ID is X)

"message": "Invalid input received: Flavor ID can only contain [0-9 ]"

Python Nova client output:
------------------------------

rajalakshmi_ganesan@ubuntu:~$ nova flavor-create ps_flavor2 2gjhffg 2 2 2
ERROR: invalid literal for int() with base 10: '2gjhffg'

CURL COMMAND OUTPUTS:
--------------------------------

rajalakshmi_ganesan@ubuntu:~$ curl -i http://15.184.64.226:8774/v2/25ecbf309f7748c6a173fabf2a673a65/flavors -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "X-Auth-Token: 0b78256729a848559f7a9a45e24ef554" -d '{"flavor": {"disk": 10, "vcpus": 2, "ram": 1024, "name": "PS_flavor_2", "id": 999a_invali.,, "swap": 22, "os-flavor-access:is_public": true, "rxtx_factor": 2, "OS-FLV-EXT-DATA:ephemeral": 2}}'
HTTP/1.1 400 Bad Request
Content-Length: 66
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-56a498ec-619f-456b-98fe-48271e9a380d
Date: Wed, 26 Sep 2012 15:09:33 GMT

{"badRequest": {"message": "Malformed request body", "code": 400}}rajalakshmi_ganesan@ubuntu:~$

Revision history for this message
Rajalakshmi Ganesan (rajalakshmi-ganesan) wrote :
Download full text (3.1 KiB)

1. WITH "Flavor ID " INPUT AS "@#$%!^&*())_+:<>?"

rajalakshmi_ganesan@ubuntu:~/source/csbu-qa/AutomatedTests/python_tests/hp_regression/nova/nova_api_tests/flavors$ curl -i http://15.184.64.226:8774/v2/30832a492d3548918482624bd4bbc00f/flavors -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: c23bbd942cf041d68aaa7537100602e8" -d '{"flavor": {"vcpus": 4, "ram": 512, "name": "invalid_id_flavor12715", "os-flavor-access:is_public": false, "rxtx_factor": 2, "OS-FLV-EXT-DATA:ephemeral": 2, "disk": 2, "id": "@#$%!^&*())_+:<>?", "swap": 512}}'
HTTP/1.1 409 Conflict
Content-Length: 104
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-e74fb20f-dc72-4ba3-b930-20722041fa0d
Date: Fri, 28 Sep 2012 11:27:29 GMT

{"conflictingRequest": {"message": "Instance Type invalid_id_flavor12715 already exists.", "code": 409}}rajalakshmi_ganesan@ubuntu:~/source/csbu-qa/AutomatedTests/python_tests/h4bbc00f/flavors -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: c23bbd942cf041d68aaa7537100602e8" -d '{"flavor": {"vcpus": 4, "ram": 512, "id": "888888", "os-flavor-access:is_public": false, "rxtx_factor": 2, "OS-FLV-EXT-DATA:ephemeral": 2, "disk": 2, "name": "@#$%!^&*())_+:<>?", "swap": 512}}'
HTTP/1.1 400
Content-Length: 106
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-554c943b-0943-4f08-ba9d-120637bfdd3f
Date: Fri, 28 Sep 2012 11:28:30 GMT

{"badRequest": {"message": "Invalid input received: names can only contain [a-zA-Z0-9_.- ]", "code": 400}}rajalakshmi_ganesan@ubuntu:~/source/csbu-qa/AutomatedTests/python_tests/hp_regression/nova/nova_api_tests/flavors$

2. WITH "Flavor ID " INPUT AS "alphabets"

rajalakshmi_ganesan@ubuntu:~/source/csbu-qa/AutomatedTests/python_tests/hp_regression/nova/nova_api_tests/flavors$ curl -i http://15.184.64.226:8774/v2/30832a492d3548918482624bd4bbc00f/flavors -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: c23bbd942cf041d68aaa7537100602e8" -d '{"flavor": {"vcpus": 4, "ram": 512, "name": "invalid_id_flavor_999", "os-flavor-access:is_public": false, "rxtx_factor": 2, "OS-FLV-EXT-DATA:ephemeral": 2, "disk": 2, "id": "aplhabets", "swap": 512}}'
HTTP/1.1 200 OK
X-Compute-Request-Id: req-27221bed-92b0-4653-96a2-740d97f2f54f
Content-Type: application/json
Content-Length: 462
Date: Fri, 28 Sep 2012 11:39:33 GMT

{"flavor": {"name": "invalid_id_flavor_999", "links": [{"href": "http://15.184.64.226:8774/v2/30832a492d3548918482624bd4bbc00f/flavors/aplhabets", "rel": "self"}, {"href": "http://15.184.64.226:8774/30832a492d3548918482624bd4bbc00f/flavors/aplhabets", "rel": "bookmark"}], "ram": 512, "OS-FLV-DISABLED:disabled": false, "vcpus": 4, "swap": 512, "os-flavor-access:is_public": false, "rxtx_factor": 2, "OS-FLV-EXT-DATA:ephemeral": 2, "disk": 2, "id": "aplhabets"}}rajalakshmi_ganesan@ubuntu:~/source/csbu-qa/AutomatedTests/python_tests/hp_regression/nova/nova_api_tests/flavo...

Read more...

summary: Folsom - Exception message for "Create Flavor" with invalid Flavor ID is
- not Clear
+ not consistent and proper
Changed in python-novaclient:
assignee: nobody → Sathish Nagappan (sathish-nagappan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/14516

Changed in python-novaclient:
status: New → In Progress
Changed in nova:
assignee: nobody → Sathish Nagappan (sathish-nagappan)
Changed in nova:
assignee: Sathish Nagappan (sathish-nagappan) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/14516
Committed: http://github.com/openstack/python-novaclient/commit/805ba8fdc1763306f4a6dbdc3de274b5c2597485
Submitter: Jenkins
Branch: master

commit 805ba8fdc1763306f4a6dbdc3de274b5c2597485
Author: Sathish Nagappan <email address hidden>
Date: Wed Oct 17 21:31:34 2012 -0700

    Exception handling for 'nova flavor-create' arguments

    Fixes client side Bug #1056935

    Throws an exception if the user does not input integers for the
    corresponding parameters.

    Change-Id: I4c4b8148f6565bc5a3b348dbde8c2cf0da00234a

Changed in python-novaclient:
status: In Progress → Fix Committed
Changed in nova:
status: New → Fix Committed
status: Fix Committed → Confirmed
importance: Undecided → Low
Changed in python-novaclient:
importance: Undecided → Low
Changed in python-novaclient:
status: Fix Committed → Fix Released
Joe Gordon (jogo)
no longer affects: nova
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.