]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Unite qos_rules and qos_*_rules tables
authorIhar Hrachyshka <ihrachys@redhat.com>
Sat, 25 Jul 2015 14:21:37 +0000 (16:21 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Sat, 1 Aug 2015 20:13:14 +0000 (22:13 +0200)
commitc9bdcb5557dbf8f782fe502dbb6c98c3550e5241
treec7b24b2fab451e15d4ec1a163a39b19abd19c675
parent3b97f79ab7756a8737df53405b3dd458e79752be
Unite qos_rules and qos_*_rules tables

The only values in qos_rules table are: type, id and qos_policy_id. Both
id fields point to qos_*_rules and qos_policies objects.

Type is redundant since qos_rule and qos_*_rule objects maintain 1-to-1
relationship.

Keeping a separate table just to link qos_*_rule and qos_policy objects
has no meaning. At the same time, it complicates the code for rule
objects significantly.

So instead of copying with all those issues, we just squash the tables
into single one. It allows us to reuse all base methods from
NeutronObject for rules.

LOC stats for the patch clearly shows the point:

65 insertions(+), 267 deletions(-)

And no actual functionality is lost.

While at it, the following changes were applied:

- some base tests are reimplemented to test objects in a more explicit
  way;
- fields_no_update class attribute is now actually enforced in base
  object class.

Partially-Implements: blueprint quantum-qos-api
Change-Id: Iadabd14c3490c842608e53ceccf38c79dcdf8d85
12 files changed:
doc/source/devref/quality_of_service.rst
neutron/common/exceptions.py
neutron/db/api.py
neutron/db/migration/alembic_migrations/versions/liberty/expand/48153cb5f051_qos_db_changes.py
neutron/db/qos/models.py
neutron/objects/base.py
neutron/objects/qos/policy.py
neutron/objects/qos/rule.py
neutron/tests/unit/objects/qos/test_policy.py
neutron/tests/unit/objects/qos/test_rule.py
neutron/tests/unit/objects/test_base.py
neutron/tests/unit/services/qos/test_qos_plugin.py