update quota with invalid value(not integer) raise 500 error

Bug #1111327 reported by Zhou ShaoYu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Zhou ShaoYu

Bug Description

Update the quota with a string cause ValueError.

http put http://localhost:8774/v2/c385278dc70b4b1cbb2c87c7892db7b5/os-quota-sets/c385278dc70b4b1cbb2c87c7892db7b5 x-auth-token:606d3179c1b746239f1c7ace994a75a0 quota_set:='{"key_pairs": ""}'

2013-01-31 18:45:59.711 ERROR nova.api.openstack [req-c2bb64d1-05c7-47b8-a4dc-0d56cadd9b6d admin admin] Caught error: invalid literal for int() with base 10: ''
2013-01-31 18:45:59.711 TRACE nova.api.openstack Traceback (most recent call last):
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 81, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack return req.get_response(self.application)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-01-31 18:45:59.711 TRACE nova.api.openstack application, catch_exc_info=False)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-01-31 18:45:59.711 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack return resp(environ, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-0.2.2.20.g3573672-py2.7.egg/keystoneclient/middleware/auth_token.py", line 348, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack return self.app(env, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack return resp(environ, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack return resp(environ, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack return resp(environ, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack response = self.app(environ, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack return resp(environ, start_response)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-01-31 18:45:59.711 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 897, in __call__
2013-01-31 18:45:59.711 TRACE nova.api.openstack content_type, body, accept)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 957, in _process_stack
2013-01-31 18:45:59.711 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 1046, in dispatch
2013-01-31 18:45:59.711 TRACE nova.api.openstack return method(req=request, **action_args)
2013-01-31 18:45:59.711 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/contrib/quotas.py", line 90, in update
2013-01-31 18:45:59.711 TRACE nova.api.openstack for key in body['quota_set'].keys():
2013-01-31 18:45:59.711 TRACE nova.api.openstack ValueError: invalid literal for int() with base 10: ''

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Zhou ShaoYu (hzzhoushaoyu)
status: New → In Progress
Revision history for this message
Zhou ShaoYu (hzzhoushaoyu) wrote :

Request as:
PUT /v2/c385278dc70b4b1cbb2c87c7892db7b5/os-quota-sets/c385278dc70b4b1cbb2c87c7892db7b5 HTTP/1.1
Accept: application/json
Accept-Encoding: identity, deflate, compress, gzip
Host: localhost:8774
User-Agent: HTTPie/0.3.0
content-type: application/xml
x-auth-token: 304ab100c4aa405aabaa3998613b190b

<?xml version='1.0' encoding='UTF-8'?>
<quota_set id="c385278dc70b4b1cbb2c87c7892db7b5">
        <security_groups></security_groups>
</quota_set>

causes

2013-02-01 11:46:49.255 ERROR nova.api.openstack.wsgi [req-0747c62b-cf4e-43ca-b70a-02425843e9ab admin admin] Exception handling resource: int() argument must be a string or a number, not 'dict'
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi Traceback (most recent call last):
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 957, in _process_stack
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi action_result = self.dispatch(meth, request, action_args)
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 1046, in dispatch
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi return method(req=request, **action_args)
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi File "/opt/stack/nova/nova/api/openstack/compute/contrib/quotas.py", line 94, in update
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi value = int(body['quota_set'][key])
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi TypeError: int() argument must be a string or a number, not 'dict'
2013-02-01 11:46:49.255 TRACE nova.api.openstack.wsgi

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/20890
Committed: http://github.com/openstack/nova/commit/43bd52ba9f59086f2aaf7c5cc3a81ca40721f887
Submitter: Jenkins
Branch: master

commit 43bd52ba9f59086f2aaf7c5cc3a81ca40721f887
Author: Zhou ShaoYu <email address hidden>
Date: Thu Jan 31 19:02:30 2013 +0800

    Fix update quota with invalid value

    If update quota with a value which is not integer, it will response
    with http status code 500. Catch the exception and continue for
    updating other quotas.

    Fix LP# 1111327

    Change-Id: I0ab3b10ff106a2e6c7677d1acdb55c2f35c492db

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-3 → 2013.1
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.