]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Overload correctly BASEV2.__table_args__
authorCedric Brandily <zzelle@gmail.com>
Fri, 23 Jan 2015 19:21:24 +0000 (19:21 +0000)
committerCedric Brandily <zzelle@gmail.com>
Fri, 23 Jan 2015 19:35:38 +0000 (19:35 +0000)
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

neutron/db/agents_db.py
neutron/db/models_v2.py
neutron/plugins/ml2/drivers/type_gre.py
neutron/plugins/ml2/drivers/type_vxlan.py
neutron/plugins/vmware/dbexts/networkgw_db.py
neutron/plugins/vmware/dbexts/nsxv_models.py

index 38ecee6c587a2c4771bdbee34b154a35b4eecf92..e9bc107fbc00d1ebe59219968ce5ab3e0802a2aa 100644 (file)
@@ -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
index f721aac83b572b53229dd4db96a106847ddae8da..e9b97daec050a58d9fd1b93b8dcb0d3295be9693 100644 (file)
@@ -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)
index 96a6715eb57d03913a8aef2cf3d7babbad280a19..ff3077384b103873a2caddfaec1e0e3e5ba33684 100644 (file)
@@ -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)
index 563179de1967d152682d9b4666fdac46ce8dd108..6b3fdc2bc851bb2e8baaac8e97684fa5a6ab3c9d 100644 (file)
@@ -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)
index a790893cccb365fec700cf0dc41d1429ee696bf8..7d3404fd070ff20cce4552a2b4a2151f68106b45 100644 (file)
@@ -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),
index 395238db0673b23509fa8f65f5782976cac98a37..369bfa7f3cab620204c0abf601ec086c083d32ac 100644 (file)
@@ -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