]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Avoid duplicating tenant check when creating resources
authorMathieu Rohon <mathieu.rohon@gmail.com>
Wed, 4 Nov 2015 17:49:40 +0000 (17:49 +0000)
committerMathieu Rohon <mathieu.rohon@gmail.com>
Tue, 5 Jan 2016 14:18:41 +0000 (14:18 +0000)
commit5d53dfb8d64186b5b1d2f356fbff8f222e15d1b2
tree823571870460cdd8822ea170c476691af266d721
parent0c073785099b768e93122d7631560099ae216782
Avoid duplicating tenant check when creating resources

The check of the tenant done in the method _get_tenant_id_for_create()
is already did by the Neutron Controller in prepare_request_body(),
with a call to attributes.populate_tenant_id().
Moreover, when the Controller processes a "create" requests, it
will add the 'tenant_id' to the resource dict.
Thus, _get_tenant_id_for_create() can be deleted.
Calls to this method are replaced by the res['tenant_id'].

Changes have to be done in UT to explicitly add the tenant_id while
creating resources, since the UT framework is bypassing the controller code
that automatically adds the tenant_id to the resource.

Co-Authored-By: Hong Hui Xiao <xiaohhui@cn.ibm.com>
Closes-Bug: #1513825
Change-Id: Icea06dc81344e1120bdf986a97a6b1094bbb765e
Depends-On: I31022e9230fc5404c6a94edabbb08d2b079c3a09
Depends-On: Iea3f014ef17a1e1b755cd2efe99afd1a36ebbc6a
Depends-On: I604602d023e0cbf7f6591149f914d73217d7a574
19 files changed:
neutron/db/address_scope_db.py
neutron/db/common_db_mixin.py
neutron/db/db_base_plugin_v2.py
neutron/db/l3_db.py
neutron/db/metering/metering_db.py
neutron/db/rbac_db_mixin.py
neutron/db/securitygroups_db.py
neutron/plugins/ml2/plugin.py
neutron/tests/functional/scheduler/test_l3_agent_scheduler.py
neutron/tests/retargetable/client_fixtures.py
neutron/tests/unit/api/rpc/handlers/test_l3_rpc.py
neutron/tests/unit/api/v2/test_attributes.py
neutron/tests/unit/db/test_agentschedulers_db.py
neutron/tests/unit/db/test_l3_hamode_db.py
neutron/tests/unit/extensions/test_l3.py
neutron/tests/unit/extensions/test_portsecurity.py
neutron/tests/unit/extensions/test_securitygroup.py
neutron/tests/unit/plugins/ml2/test_plugin.py
neutron/tests/unit/scheduler/test_l3_agent_scheduler.py