From: Cedric Brandily Date: Fri, 23 Jan 2015 19:21:24 +0000 (+0000) Subject: Overload correctly BASEV2.__table_args__ X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=0c5d35f37c9767038269d6a9e1a04e742ca925fc;p=openstack-build%2Fneutron-build.git Overload correctly BASEV2.__table_args__ neutron.db.model_base.BASEV2 defines __table_args__ attribute. Its subclasses overloading __table_args__ should inherit __table_args__ from parent class. A migration script is not needed as __table_args__ are not overloaded in neutron.db.migration.models.frozen module. Closes-Bug: #1413985 Change-Id: Ied625252714e2e952f9831d0d03c4573306fe29d --- diff --git a/neutron/db/agents_db.py b/neutron/db/agents_db.py index 38ecee6c5..e9bc107fb 100644 --- a/neutron/db/agents_db.py +++ b/neutron/db/agents_db.py @@ -46,6 +46,7 @@ class Agent(model_base.BASEV2, models_v2.HasId): __table_args__ = ( sa.UniqueConstraint('agent_type', 'host', name='uniq_agents0agent_type0host'), + model_base.BASEV2.__table_args__ ) # L3 agent, DHCP agent, OVS agent, LinuxBridge diff --git a/neutron/db/models_v2.py b/neutron/db/models_v2.py index f721aac83..e9b97daec 100644 --- a/neutron/db/models_v2.py +++ b/neutron/db/models_v2.py @@ -69,7 +69,9 @@ class IPAvailabilityRange(model_base.BASEV2): name='uniq_ipavailabilityranges0first_ip0allocation_pool_id'), sa.UniqueConstraint( last_ip, allocation_pool_id, - name='uniq_ipavailabilityranges0last_ip0allocation_pool_id')) + name='uniq_ipavailabilityranges0last_ip0allocation_pool_id'), + model_base.BASEV2.__table_args__ + ) def __repr__(self): return "%s - %s" % (self.first_ip, self.last_ip) diff --git a/neutron/plugins/ml2/drivers/type_gre.py b/neutron/plugins/ml2/drivers/type_gre.py index 96a6715eb..ff3077384 100644 --- a/neutron/plugins/ml2/drivers/type_gre.py +++ b/neutron/plugins/ml2/drivers/type_gre.py @@ -57,6 +57,7 @@ class GreEndpoints(model_base.BASEV2): __table_args__ = ( sa.UniqueConstraint('host', name='unique_ml2_gre_endpoints0host'), + model_base.BASEV2.__table_args__ ) ip_address = sa.Column(sa.String(64), primary_key=True) host = sa.Column(sa.String(255), nullable=True) diff --git a/neutron/plugins/ml2/drivers/type_vxlan.py b/neutron/plugins/ml2/drivers/type_vxlan.py index 563179de1..6b3fdc2bc 100644 --- a/neutron/plugins/ml2/drivers/type_vxlan.py +++ b/neutron/plugins/ml2/drivers/type_vxlan.py @@ -63,6 +63,7 @@ class VxlanEndpoints(model_base.BASEV2): __table_args__ = ( sa.UniqueConstraint('host', name='unique_ml2_vxlan_endpoints0host'), + model_base.BASEV2.__table_args__ ) ip_address = sa.Column(sa.String(64), primary_key=True) udp_port = sa.Column(sa.Integer, nullable=False) diff --git a/neutron/plugins/vmware/dbexts/networkgw_db.py b/neutron/plugins/vmware/dbexts/networkgw_db.py index a790893cc..7d3404fd0 100644 --- a/neutron/plugins/vmware/dbexts/networkgw_db.py +++ b/neutron/plugins/vmware/dbexts/networkgw_db.py @@ -106,7 +106,8 @@ class NetworkConnection(model_base.BASEV2, models_v2.HasTenant): segmentation_id = sa.Column(sa.Integer) __table_args__ = (sa.UniqueConstraint(network_gateway_id, segmentation_type, - segmentation_id),) + segmentation_id), + model_base.BASEV2.__table_args__) # Also, storing port id comes back useful when disconnecting a network # from a gateway port_id = sa.Column(sa.String(36), diff --git a/neutron/plugins/vmware/dbexts/nsxv_models.py b/neutron/plugins/vmware/dbexts/nsxv_models.py index 395238db0..369bfa7f3 100644 --- a/neutron/plugins/vmware/dbexts/nsxv_models.py +++ b/neutron/plugins/vmware/dbexts/nsxv_models.py @@ -203,7 +203,8 @@ class NsxvPortIndexMapping(model_base.BASEV2): primary_key=True) device_id = sa.Column(sa.String(255), nullable=False) index = sa.Column(sa.Integer, nullable=False) - __table_args__ = (sa.UniqueConstraint(device_id, index),) + __table_args__ = (sa.UniqueConstraint(device_id, index), + model_base.BASEV2.__table_args__) # Add a relationship to the Port model in order to instruct SQLAlchemy to # eagerly read port vnic-index