]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Use db constraint to ensure mac address uniqueness
authorCedric Brandily <zzelle@gmail.com>
Sat, 10 Jan 2015 14:25:04 +0000 (14:25 +0000)
committerCedric Brandily <zzelle@gmail.com>
Thu, 22 Jan 2015 19:08:47 +0000 (19:08 +0000)
commit09fe057cd475fe9068339f9805fa855476e248bf
tree64c15fbc5648ca9ac3056c001c104e54ea8d5ad2
parent58c624fad3485e7604f1fb4a6616d2b09c03d8af
Use db constraint to ensure mac address uniqueness

Currently port mac address uniqueness per network is checked before Port
db object create but without locking. It implies 2 port create requests
can allocate the same mac address on a network if each request performs
mac address uniqueness check before the other creates the Port db object.

This change replaces the check by a db unique constraint on Port
(network_id, mac_address).

Change-Id: Iad7460356ceb74d963cddf5ec33268d77792f1fe
Closes-Bug: #1194565
neutron/db/db_base_plugin_v2.py
neutron/db/migration/alembic_migrations/versions/2a1ee2fb59e0_add_mac_address_unique_constraint.py [new file with mode: 0644]
neutron/db/migration/alembic_migrations/versions/HEAD
neutron/db/models_v2.py
neutron/tests/unit/metaplugin/test_metaplugin.py
neutron/tests/unit/ml2/db/test_ml2_db.py
neutron/tests/unit/ml2/db/test_ml2_dvr_db.py
neutron/tests/unit/test_db_plugin.py