From: John Schwarz Date: Thu, 2 Jul 2015 09:40:11 +0000 (+0300) Subject: Cleanup rule models and objects X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=00589382cf1ea7034d5dee5aec8bf3814f7e92a5;p=openstack-build%2Fneutron-build.git Cleanup rule models and objects - drop tenant_id for base and bandwidth_limit rules; - added 'to_dict' function to convert objects into dicts. Change-Id: I28167e356e70235304b166c997df52ca1b28f836 --- diff --git a/neutron/db/migration/alembic_migrations/versions/48153cb5f051_qos_db_changes.py b/neutron/db/migration/alembic_migrations/versions/48153cb5f051_qos_db_changes.py index b0a020a89..d042ef83f 100755 --- a/neutron/db/migration/alembic_migrations/versions/48153cb5f051_qos_db_changes.py +++ b/neutron/db/migration/alembic_migrations/versions/48153cb5f051_qos_db_changes.py @@ -65,9 +65,7 @@ def upgrade(): sa.Column('qos_policy_id', sa.String(length=36), sa.ForeignKey('qos_policies.id', ondelete='CASCADE'), nullable=False), - sa.Column('type', sa.String(length=255)), - sa.Column('tenant_id', sa.String(length=attrs.TENANT_ID_MAX_LEN), - index=True)) + sa.Column('type', sa.String(length=255))) op.create_table( 'qos_bandwidth_limit_rules', diff --git a/neutron/db/qos/models.py b/neutron/db/qos/models.py index 90ffe08d3..a34b9367b 100755 --- a/neutron/db/qos/models.py +++ b/neutron/db/qos/models.py @@ -61,7 +61,7 @@ class QosPortPolicyBinding(model_base.BASEV2): primary_key=True) -class QosRule(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant): +class QosRule(model_base.BASEV2, models_v2.HasId): __tablename__ = 'qos_rules' type = sa.Column(sa.String(255)) qos_policy_id = sa.Column(sa.String(36), @@ -70,7 +70,7 @@ class QosRule(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant): nullable=False) -class QosBandwidthLimitRule(QosRule): +class QosBandwidthLimitRule(model_base.BASEV2): __tablename__ = 'qos_bandwidth_limit_rules' max_kbps = sa.Column(sa.Integer) max_burst_kbps = sa.Column(sa.Integer) diff --git a/neutron/objects/base.py b/neutron/objects/base.py index 57f785ea4..86d4e5bbd 100644 --- a/neutron/objects/base.py +++ b/neutron/objects/base.py @@ -36,6 +36,10 @@ class NeutronObject(obj_base.VersionedObject, break self.obj_reset_changes() + # TODO(QoS): this should be revisited on how we plan to work with dicts + def to_dict(self): + return dict(self.items()) + @classmethod def get_by_id(cls, context, id): db_obj = db_api.get_object(context, cls.db_model, id) diff --git a/neutron/objects/qos/rule.py b/neutron/objects/qos/rule.py index 55189c628..53965194f 100644 --- a/neutron/objects/qos/rule.py +++ b/neutron/objects/qos/rule.py @@ -31,7 +31,6 @@ class QosRule(base.NeutronObject): fields = { 'id': obj_fields.UUIDField(), - 'tenant_id': obj_fields.UUIDField(), 'type': obj_fields.StringField(), 'qos_policy_id': obj_fields.UUIDField() }