From f0b77aa053a2d5456d72d178d4fac8e2684cc111 Mon Sep 17 00:00:00 2001 From: Kyle Mestery Date: Fri, 16 Aug 2013 09:19:25 +0000 Subject: [PATCH] Fix ML2 VXLAN TypeDriver DB migration The migration for the ML2 VXLAN TypeDriver was incorrectly setting primary key attributes on separate lines for 'ip_address' and 'udp_port'. Also, a primary key cannot have autoincrement set, so add this to 'udp_port' as well. Fixes bug 1213134 Change-Id: I0b2e2685bf524dd9c0333ac4511287ad6a5eb87e --- .../versions/477a4488d3f4_ml2_vxlan_type_driver.py | 6 +++--- neutron/plugins/ml2/drivers/type_vxlan.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py b/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py index a57617e44..8f54b51b8 100644 --- a/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py +++ b/neutron/db/migration/alembic_migrations/versions/477a4488d3f4_ml2_vxlan_type_driver.py @@ -55,9 +55,9 @@ def upgrade(active_plugins=None, options=None): op.create_table( 'ml2_vxlan_endpoints', sa.Column('ip_address', sa.String(length=64)), - sa.Column('udp_port', sa.Integer(), nullable=False), - sa.PrimaryKeyConstraint('ip_address'), - sa.PrimaryKeyConstraint('udp_port') + sa.Column('udp_port', sa.Integer(), nullable=False, + autoincrement=False), + sa.PrimaryKeyConstraint('ip_address', 'udp_port') ) diff --git a/neutron/plugins/ml2/drivers/type_vxlan.py b/neutron/plugins/ml2/drivers/type_vxlan.py index 75f7d0b0f..a5c7f1206 100644 --- a/neutron/plugins/ml2/drivers/type_vxlan.py +++ b/neutron/plugins/ml2/drivers/type_vxlan.py @@ -59,7 +59,8 @@ class VxlanEndpoints(model_base.BASEV2): __tablename__ = 'ml2_vxlan_endpoints' ip_address = sa.Column(sa.String(64), primary_key=True) - udp_port = sa.Column(sa.Integer, primary_key=True, nullable=False) + udp_port = sa.Column(sa.Integer, primary_key=True, nullable=False, + autoincrement=False) def __repr__(self): return "" % self.ip_address -- 2.45.2