Quota Update Extension raises HTTP 500 for invalid quota value

Bug #1215301 reported by Rohit Karajgi on 2013-08-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Undecided
Rohan

Bug Description

PUT Request body:
{
"quota_set" :
    {
        "snapshots_dm-crypt": "test"
    }
}

Actual Response: {"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}

Expected Response: 400, Bad request with an appropriate error message.

c-api stacktrace:

2013-08-22 00:41:11.778 ERROR cinder.api.middleware.fault [req-fcc46cd8-3153-47e0-9036-797f54699714 a86ef7e18288428899e66c937adb53b0 bfa255a07d394bee849f8922ee6b7c3d] Caught error: invalid literal for int() with base 10: 'test'
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault Traceback (most recent call last):
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/middleware/fault.py", line 73, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return req.get_response(self.application)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault application, catch_exc_info=False)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault app_iter = application(self.environ, start_response)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 539, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return self.app(env, start_response)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault response = self.app(environ, start_response)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return resp(environ, start_response)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault resp = self.call_func(req, *args, **self.kwargs)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return self.func(req, *args, **kwargs)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 820, in __call__
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault content_type, body, accept)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 868, in _process_stack
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault action_result = self.dispatch(meth, request, action_args)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 944, in dispatch
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault return method(req=request, **action_args)
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/contrib/quotas.py", line 92, in update
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault value = int(body['quota_set'][key])
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault ValueError: invalid literal for int() with base 10: 'test'
2013-08-22 00:41:11.778 TRACE cinder.api.middleware.fault
2013-08-22 00:41:11.785 INFO cinder.api.middleware.fault [req-fcc46cd8-3153-47e0-9036-797f54699714 a86ef7e18288428899e66c937adb53b0 bfa255a07d394bee849f8922ee6b7c3d] http://10.2.3.102:8776/v2/bfa255a07d394bee849f8922ee6b7c3d/os-quota-sets/bfa255a07d394bee849f8922ee6b7c3d returned with HTTP 500

Tags: ntt Edit Tag help
Rohit Karajgi (rohitk) on 2013-08-22
Changed in cinder:
assignee: nobody → Rohit Karajgi (rohitkarajgi)
Rohan (kanaderohan) on 2013-08-23
Changed in cinder:
assignee: Rohit Karajgi (rohitkarajgi) → Rohan (kanaderohan)

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

Changed in cinder:
status: New → In Progress

Reviewed: https://review.openstack.org/43836
Committed: http://github.com/openstack/cinder/commit/60a2bf977733f2570a22b58cf650e97dabddc7fd
Submitter: Jenkins
Branch: master

commit 60a2bf977733f2570a22b58cf650e97dabddc7fd
Author: Rohan Kanade <email address hidden>
Date: Fri Aug 23 03:15:12 2013 -0700

    Fix quota update validation for non-int types

    Fixes lp bug #1215301

    Change-Id: I4bf813579c128844884138ba49f074f81f96790a

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-09-05
Changed in cinder:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers