← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1621281] Re: 500 when deleting a flavor associated to an existing router

 

Reviewed:  https://review.openstack.org/367331
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=b91fbdea73afc2a8f0234077d65308864d4737c0
Submitter: Jenkins
Branch:    master

commit b91fbdea73afc2a8f0234077d65308864d4737c0
Author: Kevin Benton <kevin@xxxxxxxxxx>
Date:   Wed Sep 7 22:07:41 2016 -0700

    Detect DBReferenceError when deleting flavor
    
    The flavor framework currently has a TODO where the logic
    to ensure the flavor isn't in use should be. Implementing
    this logic will be a bit complicated this late in the cycle
    since many different services can depend on the flavor.
    
    For now we can at least catch the DBReferenceError when trying
    to delete the flavor and convert it into the FlavorInUse
    exception.
    
    This leaves some notes inline about how we might go about
    implemented the _ensure_flavor_not_inuse function.
    
    Change-Id: I6bfe61645c6cee002020a507e489c3535d5026ab
    Closes-Bug: #1621281


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1621281

Title:
  500 when deleting a flavor associated to an existing router

Status in neutron:
  Fix Released

Bug description:
  2016-09-07 17:17:36.330 DEBUG neutron.wsgi [-] (11553) accepted ('192.168.56.101', 44115) from (pid=11553) server /usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py:868
  2016-09-07 17:17:36.331 INFO neutron.wsgi [req-9325d159-689c-4eec-a2f2-09a3cd2cdd5d tempest-RoutersFlavorTestCase-2139645665 a20e05e7617e4a0c99fb4b4c28ca018f] 192.168.56.101 - - [07/Sep/2016 17:17:36] "DE
  LETE /v2.0/flavors/343b36ce-d64f-4cb4-ae2c-23afae44eabf/service_profiles/1bf3da54-b456-4cd5-93b1-a27e4fb3508e HTTP/1.1" 204 168 0.2158262016-09-07 17:17:36.555 ERROR neutron.api.v2.resource [req-2b12a1f1-8b6a-4bea-9878-efb9f352f4b4 tempest-RoutersFlavorTestCase-2139645665 a20e05e7617e4a0c99fb4b4c28ca018f] delete failed: No details.
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource Traceback (most recent call last):
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     result = method(request=request, **args)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 526, in delete
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     return self._delete(request, id, **kwargs)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     ectxt.value = e.inner_exc
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self.force_reraise()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     return f(*args, **kwargs)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 82, in wrapped
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     traceback.format_exc())
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self.force_reraise()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 77, in wrapped
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     return f(*args, **kwargs)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 548, in _delete
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     obj_deleter(request.context, id, **kwargs)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/flavors_db.py", line 153, in delete_flavor
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     context.session.delete(fl_db)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 490, in __exit__
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self.rollback()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     compat.reraise(exc_type, exc_value, exc_tb)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 487, in __exit__
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self.commit()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 392, in commit
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self._prepare_impl()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self.session.flush()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2019, in flush
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self._flush(objects)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2137, in _flush
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     transaction.rollback(_capture_exception=True)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     compat.reraise(exc_type, exc_value, exc_tb)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2101, in _flush
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     flush_context.execute()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     rec.execute(self)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 561, in execute
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     uow
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 249, in delete_obj
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     cached_connections, mapper, table, delete)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 892, in _emit_delete_statements
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     c = connection.execute(statement, del_objects)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 914, in execute
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     return meth(self, multiparams, params)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     return connection._execute_clauseelement(self, multiparams, params)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     compiled_sql, distilled_params
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     context)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     util.raise_from_cause(newraise, exc_info)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     reraise(type(exception), exception, tb=exc_tb, cause=cause)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     context)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     cursor.execute(statement, parameters)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 167, in execute
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     result = self._query(query)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 323, in _query
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     conn.query(q)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 836, in query
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1020, in _read_query_result
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     result.read()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1303, in read
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     first_packet = self.connection._read_packet()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 982, in _read_packet
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     packet.check_error()
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 394, in check_error
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     err.raise_mysql_exception(self._data)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     _check_mysql_exception(errinfo)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 112, in _check_mysql_exception
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource     raise errorclass(errno, errorvalue)
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource DBReferenceError: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`neutron`.`routers`, CON
  STRAINT `routers_ibfk_3` FOREIGN KEY (`flavor_id`) REFERENCES `flavors` (`id`))') [SQL: u'DELETE FROM flavors WHERE flavors.id = %(id)s'] [parameters: {'id': u'343b36ce-d64f-4cb4-ae2c-23afae44eabf'}]
  2016-09-07 17:17:36.555 TRACE neutron.api.v2.resource

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1621281/+subscriptions


References