Replace "tenant_id" with "project_id"
Replace "tenant_id" with "project_id" in: - Trunk service - QoS plugin service This is part of the remaining technical debt of the specs https://specs.openstack.org/openstack/neutron-specs/specs/newton/moving-to-keystone-v3.html Change-Id: I39d049bb506f24d1e1e2a35b659c93d0a22093f8 Blueprint: https://blueprints.launchpad.net/neutron/+spec/keystone-v3
This commit is contained in:
parent
ec634103d5
commit
e49485f2aa
|
@ -442,14 +442,12 @@ class QoSPlugin(qos.QoSPluginBase):
|
||||||
|
|
||||||
:returns: a QosPolicy object
|
:returns: a QosPolicy object
|
||||||
"""
|
"""
|
||||||
# NOTE(dasm): body 'policy' contains both tenant_id and project_id
|
# TODO(ralonsoh): "project_id" check and "tenant_id" removal will be
|
||||||
# but only latter needs to be used to create QosPolicy object.
|
# unnecessary once we fully migrate to keystone V3.
|
||||||
# We need to remove redundant keyword.
|
|
||||||
# This cannot be done in other place of stacktrace, because neutron
|
|
||||||
# needs to be backward compatible.
|
|
||||||
tenant_id = policy['policy'].pop('tenant_id', None)
|
|
||||||
if not policy['policy'].get('project_id'):
|
if not policy['policy'].get('project_id'):
|
||||||
policy['policy']['project_id'] = tenant_id
|
raise lib_exc.BadRequest(resource='QoS policy',
|
||||||
|
msg='Must have "policy_id"')
|
||||||
|
policy['policy'].pop('tenant_id', None)
|
||||||
policy_obj = policy_object.QosPolicy(context, **policy['policy'])
|
policy_obj = policy_object.QosPolicy(context, **policy['policy'])
|
||||||
with db_api.CONTEXT_WRITER.using(context):
|
with db_api.CONTEXT_WRITER.using(context):
|
||||||
policy_obj.create()
|
policy_obj.create()
|
||||||
|
|
|
@ -245,7 +245,7 @@ class TrunkPlugin(service_base.ServicePluginBase):
|
||||||
id=uuidutils.generate_uuid(),
|
id=uuidutils.generate_uuid(),
|
||||||
name=trunk.get('name', ""),
|
name=trunk.get('name', ""),
|
||||||
description=trunk_description,
|
description=trunk_description,
|
||||||
project_id=trunk['tenant_id'],
|
project_id=trunk['project_id'],
|
||||||
port_id=trunk['port_id'],
|
port_id=trunk['port_id'],
|
||||||
status=constants.TRUNK_DOWN_STATUS,
|
status=constants.TRUNK_DOWN_STATUS,
|
||||||
sub_ports=sub_ports)
|
sub_ports=sub_ports)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TestTrunkServicePlugin(ml2_test_base.ML2TestFramework):
|
||||||
with self.port() as port:
|
with self.port() as port:
|
||||||
trunk_port_id = port['port']['id']
|
trunk_port_id = port['port']['id']
|
||||||
trunk_req = {'port_id': trunk_port_id,
|
trunk_req = {'port_id': trunk_port_id,
|
||||||
'tenant_id': 'test_tenant',
|
'project_id': 'test_tenant',
|
||||||
'sub_ports': []}
|
'sub_ports': []}
|
||||||
trunk_res = self.trunk_plugin.create_trunk(self.context,
|
trunk_res = self.trunk_plugin.create_trunk(self.context,
|
||||||
{'trunk': trunk_req})
|
{'trunk': trunk_req})
|
||||||
|
|
|
@ -504,7 +504,6 @@ class TestQosPlugin(base.BaseQosTestCase):
|
||||||
tenant_policy = {
|
tenant_policy = {
|
||||||
'policy': {'id': policy_id,
|
'policy': {'id': policy_id,
|
||||||
'project_id': project_id,
|
'project_id': project_id,
|
||||||
'tenant_id': project_id,
|
|
||||||
'name': 'test-policy',
|
'name': 'test-policy',
|
||||||
'description': 'Test policy description',
|
'description': 'Test policy description',
|
||||||
'shared': True,
|
'shared': True,
|
||||||
|
|
|
@ -50,7 +50,7 @@ class TrunkSkeletonTest(test_plugin.Ml2PluginV2TestCase):
|
||||||
def _create_test_trunk(self, port, subports=None):
|
def _create_test_trunk(self, port, subports=None):
|
||||||
subports = subports if subports else []
|
subports = subports if subports else []
|
||||||
trunk = {'port_id': port['port']['id'],
|
trunk = {'port_id': port['port']['id'],
|
||||||
'tenant_id': 'test_tenant',
|
'project_id': 'test_tenant',
|
||||||
'sub_ports': subports
|
'sub_ports': subports
|
||||||
}
|
}
|
||||||
response = (
|
response = (
|
||||||
|
|
|
@ -58,7 +58,7 @@ class TrunkPluginTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||||
def _create_test_trunk(self, port, subports=None):
|
def _create_test_trunk(self, port, subports=None):
|
||||||
subports = subports if subports else []
|
subports = subports if subports else []
|
||||||
trunk = {'port_id': port['port']['id'],
|
trunk = {'port_id': port['port']['id'],
|
||||||
'tenant_id': 'test_tenant',
|
'project_id': 'test_tenant',
|
||||||
'sub_ports': subports}
|
'sub_ports': subports}
|
||||||
response = (
|
response = (
|
||||||
self.trunk_plugin.create_trunk(self.context, {'trunk': trunk}))
|
self.trunk_plugin.create_trunk(self.context, {'trunk': trunk}))
|
||||||
|
|
|
@ -239,7 +239,7 @@ class TrunkPortValidatorTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||||
def test_validate_port_parent_in_use_by_trunk(self):
|
def test_validate_port_parent_in_use_by_trunk(self):
|
||||||
with self.port() as trunk_parent:
|
with self.port() as trunk_parent:
|
||||||
trunk = {'port_id': trunk_parent['port']['id'],
|
trunk = {'port_id': trunk_parent['port']['id'],
|
||||||
'tenant_id': 'test_tenant',
|
'project_id': 'test_tenant',
|
||||||
'sub_ports': []}
|
'sub_ports': []}
|
||||||
self.trunk_plugin.create_trunk(
|
self.trunk_plugin.create_trunk(
|
||||||
self.context, {trunk_api.ALIAS: trunk})
|
self.context, {trunk_api.ALIAS: trunk})
|
||||||
|
@ -252,7 +252,7 @@ class TrunkPortValidatorTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||||
with self.port() as trunk_parent,\
|
with self.port() as trunk_parent,\
|
||||||
self.port() as subport:
|
self.port() as subport:
|
||||||
trunk = {'port_id': trunk_parent['port']['id'],
|
trunk = {'port_id': trunk_parent['port']['id'],
|
||||||
'tenant_id': 'test_tenant',
|
'project_id': 'test_tenant',
|
||||||
'sub_ports': [{'port_id': subport['port']['id'],
|
'sub_ports': [{'port_id': subport['port']['id'],
|
||||||
'segmentation_type': 'vlan',
|
'segmentation_type': 'vlan',
|
||||||
'segmentation_id': 2}]}
|
'segmentation_id': 2}]}
|
||||||
|
|
Loading…
Reference in New Issue