yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #51644
[Bug 1577727] Re: nova flavor-create raises 500 error if large value passed to flavor properties
Reviewed: https://review.openstack.org/313234
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9e0032362188d3b4c6ad21881a08275591461d03
Submitter: Jenkins
Branch: master
commit 9e0032362188d3b4c6ad21881a08275591461d03
Author: dineshbhor <dinesh.bhor@xxxxxxxxxxx>
Date: Fri Apr 29 12:46:55 2016 +0000
Return 400 HTTP error for invalid flavor attributes
Currently create flavor API raises 500 error if you
pass large value to ram, disk, vcpu, swap, ephemeral,
rxtx_factor flavor properties. All integral flavor
properties are validated against db.MAX_INT(2147483647)
for maximum limit and raised exception.InvalidInput for
invalid input.
Added validation of maximum limit for flavor properties
in schema. Kept the validation of flavor properties as it
is in nova.compute.flavors as it is used by legacy flavor
create. Moved the SQL_SP_FLOAT_MAX constant to nova.db.api
so that it can be used in schema as well as in test files.
APIImpact: Return 400 status code for invalid flavor
properties.
Closes-Bug: #1577727
Change-Id: I4e50534d67ee90c585b6679644e06ee3569c8c97
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1577727
Title:
nova flavor-create raises 500 error if large value passed to flavor
properties
Status in OpenStack Compute (nova):
Fix Released
Bug description:
If large value is provided for properties other than name and ID then
500 error is raised.
All integral flavor properties are validated against db.MAX_INT(2147483647) for maximum limit and raised exception.InvalidInput for invalid input.
As exception.InvalidInput is not caught, it is returning 500 InternalServerError.
Expected result:
Instead of 500 InternalServerError it should return 400 HTTPBadRequest with message 'Invalid input received: ram must be <= 2147483647'.
Command:
nova flavor-create new_flavor 35 23478279183291369182 200 2
Output:
ERROR (ClientException): Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'nova.exception.InvalidInput'> (HTTP 500) (Request-ID: req-35f422d1-7232-4dfa-ab8e-7de36d11dcaf)
n-api LOG:
2016-05-04 06:15:20.072 ERROR nova.api.openstack.extensions [req-35f422d1-7232-4dfa-ab8e-7de36d11dcaf admin admin] Unexpected exception in API method
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions Traceback (most recent call last):
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/openstack/extensions.py", line 478, in wrapped
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions return f(*args, **kwargs)
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/openstack/compute/flavor_manage.py", line 81, in _create
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions is_public=is_public)
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/flavors.py", line 152, in create
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions db.MAX_INT)
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/utils.py", line 1030, in validate_integer
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions 'max_value': max_value})
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions InvalidInput: Invalid input received: ram must be <= 2147483647
2016-05-04 06:15:20.072 TRACE nova.api.openstack.extensions
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1577727/+subscriptions
References