← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1648314] Re: create/update resource_class APIs raises HTTP 500 Internal Server Error when name is greater than 255 characters

 

Reviewed:  https://review.openstack.org/409002
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=874e666e7a53ad59b820791491584ba0f8276fd1
Submitter: Jenkins
Branch:    master

commit 874e666e7a53ad59b820791491584ba0f8276fd1
Author: bhagyashris <bhagyashri.shewale@xxxxxxxxxxx>
Date:   Wed Dec 7 18:28:48 2016 +0530

    Return 400 when name is more than 255 characters
    
    APIs listed below are returning 500 error if you pass name more than
    255 characters.
    1. create resource_classes
    2. update resource_classes
    
    Added maxLength check in schema to ensure name should not be more than
    255 characters.
    
    Closes-Bug: #1648314
    Change-Id: I4ae54f3061fe43d87a656088db1d2ae454eb8237


** 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/1648314

Title:
  create/update resource_class APIs raises HTTP 500 Internal Server
  Error when name is greater than 255 characters

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  create/update resource_class APIs raises HTTP 500 Internal Server Error if you pass name
  greater than 255 characters

  Steps to reproduce:

  create resource class by passing the name parameter greater than 255
  character

  $ curl -g -i -X POST http://10.232.48.200/placement/resource_classes
  -H "OpenStack-API-Version: placement 1.2" -H "Content-Type:
  application/json" -H "X-Auth-Token: cc6e31c316a24820a6d9257cdb9d802f"
  -d '{"name":
  "CUSTOM_TESTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}'

  Output:

  HTTP/1.1 500 Internal Server Error
  Date: Wed, 07 Dec 2016 08:02:05 GMT
  Server: Apache/2.4.7 (Ubuntu)
  x-openstack-request-id: req-a836bf46-e51d-4bfe-814d-59c2aa62fd82
  Content-Length: 128
  Connection: close
  Content-Type: application/json; charset=UTF-8

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

  Error Logs:

  2016-12-08 12:04:13.122 TRACE nova.api.openstack Traceback (most recent call last):
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/
  __init__.py", line 88, in __call__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return req.get_response(self.applicatio
  n)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packa
  ges/webob/request.py", line 1299, in send
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     application, catch_exc_info=False)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packa
  ges/webob/request.py", line 1263, in call_application
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     app_iter = application(self.environ, st
  art_response)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packa
  ges/webob/dec.py", line 130, in __call__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     resp = self.call_func(req, *args, **sel
  f.kwargs)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packa
  ges/webob/dec.py", line 195, in call_func
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return self.func(req, *args, **kwargs)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/
  placement/microversion.py", line 104, in __call__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     response = req.get_response(self.applic
  ation)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packa
  ges/webob/request.py", line 1299, in send
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     application, catch_exc_info=False)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packa
  ges/webob/request.py", line 1263, in call_application
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     app_iter = application(self.environ, st
  art_response)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/placement/handler.py", line 195, in __call__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return dispatch(environ, start_response, self._map)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/placement/handler.py", line 122, in dispatch
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return handler(environ, start_response)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     resp = self.call_func(req, *args, **self.kwargs)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return self.func(req, *args, **kwargs)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/placement/microversion.py", line 245, in decorated_func
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return _find_method(f, version_float)(req, *args, **kwargs)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/placement/util.py", line 133, in decorated_function
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return f(req)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/placement/handlers/resource_class.py", line 78, in create_resource_class
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     rc.create()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/opt/stack/nova/nova/objects/resource_provider.py", line 1203, in create
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     rc = self._create_in_db(self._context, updates)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/enginefacade.py", line 824, in wrapper
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return fn(*args, **kwargs)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self.gen.next()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/enginefacade.py", line 875, in _transaction_scope
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     yield resource
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self.gen.next()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/enginefacade.py", line 522, in _session
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self._end_session_transaction(self.session)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/enginefacade.py", line 543, in _end_session_transaction
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     session.commit()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 801, in commit
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self.transaction.commit()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 392, in commit
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self._prepare_impl()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self.session.flush()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2019, in flush
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self._flush(objects)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2137, in _flush
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     transaction.rollback(_capture_exception=True)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     compat.reraise(exc_type, exc_value, exc2016-12-08 12:04:13.122 TRACE nova.api.openstack     compat.reraise(exc_type, exc_value, exc_tb)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2101, in _flush
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     flush_context.execute()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     rec.execute(self)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 532, in execute
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     uow
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 174, in save_obj
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     mapper, table, insert)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 767, in _emit_insert_statements
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     execute(statement, multiparams)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 914, in execute
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return meth(self, multiparams, params)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     return connection._execute_clauseelement(self, multiparams, params)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     compiled_sql, distilled_params
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     context)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     util.raise_from_cause(newraise, exc_info)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     reraise(type(exception), exception, tb=exc_tb, cause=cause)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     context)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     cursor.execute(statement, parameters)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 166, in execute
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     result = self._query(query)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 166, in execute
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     result = self._query(query)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 322, in _query
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     conn.query(q)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 835, in query
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1019, in _read_query_result
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     result.read()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1302, in read
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     first_packet = self.connection._read_packet()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 981, in _read_packet
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     packet.check_error()
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 393, in check_error
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     err.raise_mysql_exception(self._data)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack   File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
  2016-12-08 12:04:13.122 TRACE nova.api.openstack     raise errorclass(errno, errval)
  2016-12-08 12:04:13.122 TRACE nova.api.openstack DBError: (pymysql.err.DataError) (1406, u"Data too long for column 'name' at row 1") [SQL: u'INSERT INTO resource_classes (created_at, updated_at, id, name) VALUES (%(created_at)s, %(updated_at)s, %(id)s, %(name)s)'] [parameters: {'created_at': datetime.datetime(2016, 12, 8, 6, 34, 13, 109271), 'id': 10001, 'name': u'CUSTOM_TESTAAAAAAAAAAAAAAAAAAAAAAA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