Reviewed: https://review.openstack.org/291685 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=8f866145f3d1c1234c4feaca2e72fe4e8f7ecf99 Submitter: Jenkins Branch: master
commit 8f866145f3d1c1234c4feaca2e72fe4e8f7ecf99 Author: Ann Kamyshnikova <akamyshnik...@mirantis.com> Date: Fri Mar 11 15:09:49 2016 +0300 Use context manager in bind NetworkDhcpAgent In bind() method of dhcp_agent_scheduler for transaction was not used context manager. This is not correct as if another exception appear, not DBDuplicateEntry, that is caught, current transaction will hang. Current change is a simple refactoring, the code works as it does prevously. Existing unit tests * test_schedule_bind_network_multi_agent_fail_one, * test_auto_schedule_network(Network already scheduled) cover possible issues. Closes-bug: #1557546 Change-Id: Ieb77738e065b997e0ab65afdc1f3bdbfb8f13fef ** Changed in: neutron Status: New => 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/1557546 Title: Correct usage of context manager for transactions Status in neutron: Fix Released Bug description: When we working with transaction we should use context manager as if exception appears transaction can hang. The code like: context.session.begin(subtransactions=True) ... try: context.session.add(binding) context.session.commit() except db_exc.DBDuplicateEntry: context.session.rollback() is not safe becuase if another exception, not DBDuplicateEntry will be raised, transaction will hang. To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1557546/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp