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
This commit is contained in:
Kyle Mestery 2013-08-16 09:19:25 +00:00
parent e79cc52ee5
commit f0b77aa053
2 changed files with 5 additions and 4 deletions

View File

@ -55,9 +55,9 @@ def upgrade(active_plugins=None, options=None):
op.create_table( op.create_table(
'ml2_vxlan_endpoints', 'ml2_vxlan_endpoints',
sa.Column('ip_address', sa.String(length=64)), sa.Column('ip_address', sa.String(length=64)),
sa.Column('udp_port', sa.Integer(), nullable=False), sa.Column('udp_port', sa.Integer(), nullable=False,
sa.PrimaryKeyConstraint('ip_address'), autoincrement=False),
sa.PrimaryKeyConstraint('udp_port') sa.PrimaryKeyConstraint('ip_address', 'udp_port')
) )

View File

@ -59,7 +59,8 @@ class VxlanEndpoints(model_base.BASEV2):
__tablename__ = 'ml2_vxlan_endpoints' __tablename__ = 'ml2_vxlan_endpoints'
ip_address = sa.Column(sa.String(64), primary_key=True) 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): def __repr__(self):
return "<VxlanTunnelEndpoint(%s)>" % self.ip_address return "<VxlanTunnelEndpoint(%s)>" % self.ip_address