detachedinstance error when creating router from auto allocate

Bug #1616126 reported by Kevin Benton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Kevin Benton

Bug Description

Traceback below seems to be caused by passing a DB object into create_router for the gw_info rather than a standard dict.

2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource [req-152d2fff-ec6f-4049-9753-e9bcf35bd7ef tempest-AutoAllocateNetworkTest-145714278 -] show failed: No details.
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource Traceback (most recent call last):
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/resource.py", line 79, in resource
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource result = method(request=request, **args)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource ectxt.value = e.inner_exc
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 92, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource traceback.format_exc())
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 87, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return f(*dup_args, **dup_kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/base.py", line 347, in show
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource parent_id=parent_id),
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/base.py", line 310, in _item
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource obj = obj_getter(request.context, id, **kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/services/auto_allocate/db.py", line 138, in get_auto_allocated_topology
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource context, tenant_id, default_external_network)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/services/auto_allocate/db.py", line 165, in _build_topology
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource router_id=router_id, subnets=subnets)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/services/auto_allocate/db.py", line 151, in _build_topology
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource context, default_external_network, subnets, tenant_id)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/services/auto_allocate/db.py", line 289, in _provision_external_connectivity
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource context, {'router': router_args})
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 103, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return method(self, context, *args, **kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource ectxt.value = e.inner_exc
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 92, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource traceback.format_exc())
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 87, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return f(*dup_args, **dup_kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/l3_hamode_db.py", line 474, in create_router
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self).create_router(context, router)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/l3_db.py", line 1747, in create_router
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource router)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 103, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return method(self, context, *args, **kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource ectxt.value = e.inner_exc
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 92, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource traceback.format_exc())
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/api.py", line 87, in wrapped
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return f(*dup_args, **dup_kwargs)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/l3_db.py", line 273, in create_router
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource transaction=False)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/common_db_mixin.py", line 76, in safe_creation
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource 'exc': e})
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.force_reraise()
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/common_db_mixin.py", line 68, in safe_creation
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource value = create_bindings(obj['id'])
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/l3_db.py", line 260, in _update_gw_for_create_router
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource gw_info, router=router_db)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/l3_gwmode_db.py", line 69, in _update_router_gw_info
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource context, router_id, info, router=router)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/l3_db.py", line 517, in _update_router_gw_info
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource network_id = self._validate_gw_info(context, gw_port, info, ext_ips)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/db/l3_db.py", line 408, in _validate_gw_info
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource network_id = info['network_id'] if info else None
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/models.py", line 54, in __getitem__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return getattr(self, key)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 237, in __get__
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource return self.impl.get(instance_state(instance), dict_)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 578, in get
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource value = state._load_expired(state, passive)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/state.py", line 474, in _load_expired
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource self.manager.deferred_scalar_loader(self, toload)
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 610, in load_scalar_attributes
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource (state_str(state)))
2016-08-23 12:29:55.959 18391 ERROR neutron.api.v2.resource DetachedInstanceError: Instance <ExternalNetwork at 0x7f518457ba50> is not bound to a Session; attribute refresh operation cannot proceed

Changed in neutron:
assignee: nobody → Kevin Benton (kevinbenton)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Armando Migliaccio (<email address hidden>) on branch: master
Review: https://review.openstack.org/359303
Reason: The gate will be grateful if we save one patch to churn.

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

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

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

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

commit fef301979eefad717f185170bb5f7ee2ed365aaf
Author: Kevin Benton <email address hidden>
Date: Wed Sep 7 18:09:21 2016 -0700

    Don't return ext net DB object in auto allocate

    Returning a DB object for the external network and passing
    that to the create_router operation makes the life of the
    DB object transition many operations. If any of those operations
    detech it from the session or expire it, it can result in
    an exception down in the router operations.

    This patch just returns the network ID since that's all we need.

    Closes-Bug: #1616126
    Change-Id: Ib9c4ba9f00ca7f7a713a89be4f75a230b086ac38

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 9.0.0.0rc1

This issue was fixed in the openstack/neutron 9.0.0.0rc1 release candidate.

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.