[openstack-dev] [neutron] InvalidRequestError: This session is in 'prepared' state; no further SQL can be emitted within this transaction.

Koteswar koti.kelam at gmail.com
Mon Jan 11 10:26:51 UTC 2016


vendor specific mech driver code, where I am doing some read/write to sql.

def _create_port(self, port): switchports = port['port']['switchports']
LOG.debug(_LE("_create_port switch: %s"), port) network_id = port['port']['
network_id'] subnets = db.get_subnets_by_network(self.context, network_id)
if not subnets: LOG.error("Subnet not found for the network")
self._raise_ml2_error(wexc.HTTPNotFound,
'create_port') for switchport in switchports: switch_mac_id = switchport['
switch_id'] port_id = switchport['port_id'] bnp_switch =
db.get_bnp_phys_switch_by_mac(self.context, switch_mac_id) # check for port
and switch level existence if not bnp_switch: LOG.error(_LE("No physical
switch found '%s' "), switch_mac_id) self._raise_ml2_error(wexc.HTTPNotFound,
'create_port') phys_port = db.get_bnp_phys_port(self.context, bnp_switch.id,
port_id) if not phys_port: LOG.error(_LE("No physical port found for '%s' "),
phys_port) self._raise_ml2_error(wexc.HTTPNotFound, 'create_port') if
bnp_switch.status != constants.SWITCH_STATUS['enable']: LOG.error(_LE("Physical
switch is not Enabled '%s' "), bnp_switch.status)
self._raise_ml2_error(wexc.HTTPBadRequest,
'create_port')

On Mon, Jan 11, 2016 at 2:47 PM, Anna Kamyshnikova <
akamyshnikova at mirantis.com> wrote:

> Hi!
>
> Can you point what mechanism driver is this or the piece of code that give
> this error?
>
> On Mon, Jan 11, 2016 at 11:58 AM, Koteswar <koti.kelam at gmail.com> wrote:
>
>> Hi All,
>>
>>
>>
>> In my mechanism driver, I am reading/writing into sql db in a fixed
>> interval looping call. Sometimes I get the following error when I stop and
>> start neutron server
>>
>> InvalidRequestError: This session is in 'prepared' state; no further SQL
>> can be emitted within this transaction.
>>
>>
>>
>> I am using context.session.query() for add, delete, update and get.
>> Please help me if any one resolved an issue like this.
>>
>>
>>
>> Full trace is as follows:
>>
>> 2016-01-06 15:33:21.799 [01;31mERROR neutron.plugins.ml2.managers
>> [[01;36mreq-d940a1b6-253a-43d2-b5ff-6c784c8a520f [00;36madmin
>> 83b5358da62a407f88155f447966356f[01;31m] [01;35m[01;31mMechanism driver
>> 'hp' failed in create_port_precommit[00m
>>
>> [01;31m2016-01-06 15:33:21.799 TRACE neutron.plugins.ml2.managers
>> [01;35m[00mTraceback (most recent call last):
>>
>> [01;31m2016-01-06 15:33:21.799 TRACE neutron.plugins.ml2.managers
>> [01;35m[00m  File "/opt/stack/neutron/neutron/plugins/ml2/managers.py",
>> line 394, in _call_on_drivers
>>
>> [01;31m2016-01-06 15:33:21.799 TRACE neutron.plugins.ml2.managers
>> [01;35m[00m    getattr(driver.obj, method_name)(context)
>>
>> [01;31m2016-01-06 15:33:21.799 TRACE neutron.plugins.ml2.managers
>> [01;35m[00m  File
>> "/usr/local/lib/python2.7/dist-packages/baremetal_network_provisioning/ml2/mechanism_hp.py",
>> line 67, in create_port_precommit
>>
>> [01;31m2016-01-06 15:33:21.799 TRACE neutron.plugins.ml2.managers
>> [01;35m[00m    raise e
>>
>> [01;31m2016-01-06 15:33:21.799 TRACE neutron.plugins.ml2.managers
>> [01;35m[00mInvalidRequestError: This session is in 'prepared' state; no
>> further SQL can be emitted within this transaction.
>>
>> [01;31m2016-01-06 15:33:21.799 TRACE neutron.plugins.ml2.managers
>> [01;35m[00m
>>
>> 2016-01-06 15:33:21.901 [01;31mERROR neutron.api.v2.resource
>> [[01;36mreq-d940a1b6-253a-43d2-b5ff-6c784c8a520f [00;36madmin
>> 83b5358da62a407f88155f447966356f[01;31m] [01;35m[01;31mcreate failed[00m
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00mTraceback (most recent call last):
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    result = method(request=request, **args)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 146, in
>> wrapper
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    ectxt.value = e.inner_exc
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line
>> 195, in __exit__
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    six.reraise(self.type_, self.value, self.tb)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 136, in
>> wrapper
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    return f(*args, **kwargs)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/api/v2/base.py", line 516, in create
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    obj = do_create(body)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/api/v2/base.py", line 498, in do_create
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    request.context, reservation.reservation_id)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line
>> 195, in __exit__
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    six.reraise(self.type_, self.value, self.tb)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/api/v2/base.py", line 491, in do_create
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    return obj_creator(request.context, **kwargs)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 146, in
>> wrapper
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    ectxt.value = e.inner_exc
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line
>> 195, in __exit__
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    six.reraise(self.type_, self.value, self.tb)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 136, in
>> wrapper
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    return f(*args, **kwargs)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 1040, in
>> create_port
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    result, mech_context = self._create_port_db(context, port)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 1032, in
>> _create_port_db
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    self.mechanism_manager.create_port_precommit(mech_context)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 590, in
>> create_port_precommit
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    self._call_on_drivers("create_port_precommit", context)
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>> File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 405, in
>> _call_on_drivers
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00m    method=method_name
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource
>> [01;35m[00mMechanismDriverError: create_port_precommit failed.
>>
>> [01;31m2016-01-06 15:33:21.901 TRACE neutron.api.v2.resource [01;35m[00m
>>
>>
>>
>> Regards,
>>
>> Koteswar
>>
>> __________________________________________________________________________
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe:
>> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>
>
> --
> Regards,
> Ann Kamyshnikova
> Mirantis, Inc
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160111/12afe237/attachment.html>


More information about the OpenStack-dev mailing list