]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Gracefully handle duplicate rule creation
authorJohn Schwarz <jschwarz@redhat.com>
Mon, 3 Aug 2015 15:33:44 +0000 (18:33 +0300)
committerIhar Hrachyshka <ihrachys@redhat.com>
Wed, 5 Aug 2015 15:28:17 +0000 (17:28 +0200)
commit75737c5ef0f7abe8aab80f77336ff9be18494ebc
treebf43a57c763d840d3f87d3e29cc8127a1d77f1e6
parentcc0ae6dd49da3e67c1d0400bc422e735c27e98fb
Gracefully handle duplicate rule creation

Previously, creating a second bandwidth limit rule for a policy raised
an uncaught exception, which eventually caused 'ServerFault' on the
client side. This patch replaces this exception with a NeutronException
which leads to a more correct 'Conflict' error instead.

Note that the code is implemented in the base object class. This means
that future versioned objects will also feature this restriction if
their database implies that no duplicate entries can be created.

Change-Id: I882d60843e1e651f3f9754746ac670f499431466
Partially-Implements: quantum-qos-api
neutron/objects/base.py
neutron/tests/api/test_qos.py
neutron/tests/unit/objects/test_base.py