Juno_initial migration
Havana was deprecated with the kilo release, and icehouse will be deprecated with the liberty release, so havana_inital migration should be removed and replaced with juno_initial. Closes-bug: #1461103 Change-Id: I2e6802c9ab64d164bd888278d555dfeeaf47257b
This commit is contained in:
@@ -30,10 +30,13 @@ def upgrade():
|
||||
sa.Column('binary', sa.String(length=255), nullable=False),
|
||||
sa.Column('topic', sa.String(length=255), nullable=False),
|
||||
sa.Column('host', sa.String(length=255), nullable=False),
|
||||
sa.Column('admin_state_up', sa.Boolean(), nullable=False),
|
||||
sa.Column('admin_state_up', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.true()),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('started_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('heartbeat_timestamp', sa.DateTime(), nullable=False),
|
||||
sa.Column('description', sa.String(length=255), nullable=True),
|
||||
sa.Column('configurations', sa.String(length=4095), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('agent_type', 'host',
|
||||
name='uniq_agents0agent_type0host'))
|
||||
|
||||
@@ -28,7 +28,8 @@ def upgrade():
|
||||
|
||||
op.create_table(
|
||||
'brocadeports',
|
||||
sa.Column('port_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('port_id', sa.String(length=36), nullable=False,
|
||||
server_default=''),
|
||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('admin_state_up', sa.Boolean(), nullable=False),
|
||||
sa.Column('physical_interface', sa.String(length=36), nullable=True),
|
||||
@@ -36,3 +37,23 @@ def upgrade():
|
||||
sa.Column('tenant_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['brocadenetworks.id'], ),
|
||||
sa.PrimaryKeyConstraint('port_id'))
|
||||
|
||||
op.create_table(
|
||||
'ml2_brocadenetworks',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('vlan', sa.String(length=10), nullable=True),
|
||||
sa.Column('segment_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('network_type', sa.String(length=10), nullable=True),
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'ml2_brocadeports',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('admin_state_up', sa.Boolean(), nullable=False),
|
||||
sa.Column('physical_interface', sa.String(length=36), nullable=True),
|
||||
sa.Column('vlan_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['ml2_brocadenetworks.id']))
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.plugins.cisco.common import cisco_constants
|
||||
|
||||
segment_type = sa.Enum('vlan', 'overlay', 'trunk', 'multi-segment',
|
||||
name='segment_type')
|
||||
@@ -31,15 +32,6 @@ def upgrade():
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_n1kv_vlan_allocations',
|
||||
sa.Column('physical_network', sa.String(length=64), nullable=False),
|
||||
sa.Column('vlan_id', sa.Integer(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.PrimaryKeyConstraint('physical_network', 'vlan_id'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_network_profiles',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
@@ -47,7 +39,8 @@ def upgrade():
|
||||
sa.Column('segment_type', segment_type, nullable=False),
|
||||
sa.Column('sub_type', sa.String(length=255), nullable=True),
|
||||
sa.Column('segment_range', sa.String(length=255), nullable=True),
|
||||
sa.Column('multicast_ip_index', sa.Integer(), nullable=True),
|
||||
sa.Column('multicast_ip_index', sa.Integer(), nullable=True,
|
||||
server_default='0'),
|
||||
sa.Column('multicast_ip_range', sa.String(length=255), nullable=True),
|
||||
sa.Column('physical_network', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
@@ -56,9 +49,29 @@ def upgrade():
|
||||
'cisco_n1kv_vxlan_allocations',
|
||||
sa.Column('vxlan_id', sa.Integer(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.Column('network_profile_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['network_profile_id'],
|
||||
['cisco_network_profiles.id'],
|
||||
ondelete='CASCADE',
|
||||
name='cisco_n1kv_vxlan_allocations_ibfk_1'),
|
||||
sa.PrimaryKeyConstraint('vxlan_id'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_n1kv_vlan_allocations',
|
||||
sa.Column('physical_network', sa.String(length=64), nullable=False),
|
||||
sa.Column('vlan_id', sa.Integer(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), autoincrement=False,
|
||||
nullable=False, server_default=sa.sql.false()),
|
||||
sa.Column('network_profile_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('physical_network', 'vlan_id'),
|
||||
sa.ForeignKeyConstraint(['network_profile_id'],
|
||||
['cisco_network_profiles.id'],
|
||||
ondelete='CASCADE',
|
||||
name='cisco_n1kv_vlan_allocations_ibfk_1'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_credentials',
|
||||
sa.Column('credential_id', sa.String(length=255), nullable=True),
|
||||
@@ -76,19 +89,11 @@ def upgrade():
|
||||
sa.Column('qos_desc', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('tenant_id', 'qos_name'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_nexusport_bindings',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('port_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('vlan_id', sa.Integer(), nullable=False),
|
||||
sa.Column('switch_ip', sa.String(length=255), nullable=False),
|
||||
sa.Column('instance_id', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_n1kv_profile_bindings',
|
||||
sa.Column('profile_type', profile_type, nullable=True),
|
||||
sa.Column('tenant_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('tenant_id', sa.String(length=36), nullable=False,
|
||||
server_default=cisco_constants.TENANT_ID_NOT_SET),
|
||||
sa.Column('profile_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('tenant_id', 'profile_id'))
|
||||
|
||||
@@ -153,3 +158,82 @@ def upgrade():
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['profile_id'], ['cisco_policy_profiles.id']),
|
||||
sa.PrimaryKeyConstraint('port_id'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_csr_identifier_map',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('ipsec_site_conn_id', sa.String(length=64),
|
||||
primary_key=True),
|
||||
sa.Column('csr_tunnel_id', sa.Integer(), nullable=False),
|
||||
sa.Column('csr_ike_policy_id', sa.Integer(), nullable=False),
|
||||
sa.Column('csr_ipsec_policy_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['ipsec_site_conn_id'],
|
||||
['ipsec_site_connections.id'],
|
||||
ondelete='CASCADE')
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_host_links',
|
||||
sa.Column('host', sa.String(length=255), nullable=False),
|
||||
sa.Column('ifname', sa.String(length=64), nullable=False),
|
||||
sa.Column('ifmac', sa.String(length=32), nullable=True),
|
||||
sa.Column('swid', sa.String(length=32), nullable=False),
|
||||
sa.Column('module', sa.String(length=32), nullable=False),
|
||||
sa.Column('port', sa.String(length=32), nullable=False),
|
||||
sa.PrimaryKeyConstraint('host', 'ifname'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_names',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('neutron_type', sa.String(length=32), nullable=False),
|
||||
sa.Column('apic_name', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('neutron_id', 'neutron_type'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_contracts',
|
||||
sa.Column('tenant_id', sa.String(length=255)),
|
||||
sa.Column('router_id', sa.String(length=64), nullable=False),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id']),
|
||||
sa.PrimaryKeyConstraint('router_id'))
|
||||
|
||||
op.create_table('cisco_hosting_devices',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('complementary_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('device_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('admin_state_up', sa.Boolean(), nullable=False),
|
||||
sa.Column('management_port_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('protocol_port', sa.Integer(), nullable=True),
|
||||
sa.Column('cfg_agent_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('status', sa.String(length=16), nullable=True),
|
||||
sa.ForeignKeyConstraint(['cfg_agent_id'], ['agents.id'], ),
|
||||
sa.ForeignKeyConstraint(['management_port_id'], ['ports.id'],
|
||||
ondelete='SET NULL'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('cisco_port_mappings',
|
||||
sa.Column('logical_resource_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('logical_port_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('port_type', sa.String(length=32), nullable=True),
|
||||
sa.Column('network_type', sa.String(length=32), nullable=True),
|
||||
sa.Column('hosting_port_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('segmentation_id', sa.Integer(), autoincrement=False,
|
||||
nullable=True),
|
||||
sa.ForeignKeyConstraint(['hosting_port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['logical_port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('logical_resource_id', 'logical_port_id')
|
||||
)
|
||||
op.create_table('cisco_router_mappings',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('auto_schedule', sa.Boolean(), nullable=False),
|
||||
sa.Column('hosting_device_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['hosting_device_id'],
|
||||
['cisco_hosting_devices.id'],
|
||||
ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id')
|
||||
)
|
||||
|
||||
@@ -54,6 +54,14 @@ def upgrade():
|
||||
sa.Column('gateway_ip', sa.String(length=64), nullable=True),
|
||||
sa.Column('enable_dhcp', sa.Boolean(), nullable=True),
|
||||
sa.Column('shared', sa.Boolean(), nullable=True),
|
||||
sa.Column('ipv6_ra_mode',
|
||||
sa.Enum('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless',
|
||||
name='ipv6_ra_modes'),
|
||||
nullable=True),
|
||||
sa.Column('ipv6_address_mode',
|
||||
sa.Enum('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless',
|
||||
name='ipv6_address_modes'),
|
||||
nullable=True),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
|
||||
+16
-13
@@ -1,4 +1,4 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
# Copyright 2015 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@@ -13,18 +13,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""L2 models to support DVR
|
||||
|
||||
Revision ID: 2026156eab2f
|
||||
Revises: 3927f7f7c456
|
||||
Create Date: 2014-06-23 19:12:43.392912
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2026156eab2f'
|
||||
down_revision = '3927f7f7c456'
|
||||
|
||||
# Initial operations for dvr
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
@@ -60,3 +49,17 @@ def upgrade():
|
||||
ondelete='SET NULL'),
|
||||
sa.PrimaryKeyConstraint('port_id', 'host')
|
||||
)
|
||||
op.create_table(
|
||||
'csnat_l3_agent_bindings',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('l3_agent_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('host_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('csnat_gw_port_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['csnat_gw_port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id')
|
||||
)
|
||||
@@ -1,290 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
import alembic
|
||||
from alembic import autogenerate as autogen
|
||||
from alembic import context
|
||||
from alembic import op
|
||||
|
||||
import six
|
||||
import sqlalchemy
|
||||
from sqlalchemy import schema as sa_schema
|
||||
import sqlalchemy.sql.expression as expr
|
||||
from sqlalchemy.sql import text
|
||||
from sqlalchemy import types
|
||||
|
||||
from neutron.db.migration.models import frozen as frozen_models
|
||||
from neutron.i18n import _LI, _LW
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
METHODS = {}
|
||||
|
||||
|
||||
def heal():
|
||||
# This is needed else the heal script will start spewing
|
||||
# a lot of pointless warning messages from alembic.
|
||||
LOG.setLevel(logging.INFO)
|
||||
if context.is_offline_mode():
|
||||
return
|
||||
models_metadata = frozen_models.get_metadata()
|
||||
# Compare metadata from models and metadata from migrations
|
||||
# Diff example:
|
||||
# [ ( 'add_table',
|
||||
# Table('bat', MetaData(bind=None),
|
||||
# Column('info', String(), table=<bat>), schema=None)),
|
||||
# ( 'remove_table',
|
||||
# Table(u'bar', MetaData(bind=None),
|
||||
# Column(u'data', VARCHAR(), table=<bar>), schema=None)),
|
||||
# ( 'add_column',
|
||||
# None,
|
||||
# 'foo',
|
||||
# Column('data', Integer(), table=<foo>)),
|
||||
# ( 'remove_column',
|
||||
# None,
|
||||
# 'foo',
|
||||
# Column(u'old_data', VARCHAR(), table=None)),
|
||||
# [ ( 'modify_nullable',
|
||||
# None,
|
||||
# 'foo',
|
||||
# u'x',
|
||||
# { 'existing_server_default': None,
|
||||
# 'existing_type': INTEGER()},
|
||||
# True,
|
||||
# False)]]
|
||||
opts = {
|
||||
'compare_type': _compare_type,
|
||||
'compare_server_default': _compare_server_default,
|
||||
}
|
||||
mc = alembic.migration.MigrationContext.configure(op.get_bind(), opts=opts)
|
||||
set_storage_engine(op.get_bind(), "InnoDB")
|
||||
diff = autogen.compare_metadata(mc, models_metadata)
|
||||
for el in diff:
|
||||
execute_alembic_command(el)
|
||||
|
||||
|
||||
def execute_alembic_command(command):
|
||||
# Commands like add_table, remove_table, add_index, add_column, etc is a
|
||||
# tuple and can be handle after running special functions from alembic for
|
||||
# them.
|
||||
if isinstance(command, tuple):
|
||||
# Here methods add_table, drop_index, etc is running. Name of method is
|
||||
# the first element of the tuple, arguments to this method comes from
|
||||
# the next element(s).
|
||||
if command[0] in METHODS:
|
||||
METHODS[command[0]](*command[1:])
|
||||
else:
|
||||
LOG.warning(_LW("Ignoring alembic command %s"), command[0])
|
||||
else:
|
||||
# For all commands that changing type, nullable or other parameters
|
||||
# of the column is used alter_column method from alembic.
|
||||
parse_modify_command(command)
|
||||
|
||||
|
||||
def parse_modify_command(command):
|
||||
# From arguments of command is created op.alter_column() that has the
|
||||
# following syntax:
|
||||
# alter_column(table_name, column_name, nullable=None,
|
||||
# server_default=False, new_column_name=None, type_=None,
|
||||
# autoincrement=None, existing_type=None,
|
||||
# existing_server_default=False, existing_nullable=None,
|
||||
# existing_autoincrement=None, schema=None, **kw)
|
||||
bind = op.get_bind()
|
||||
for modified, schema, table, column, existing, old, new in command:
|
||||
if modified.endswith('type'):
|
||||
modified = 'type_'
|
||||
elif modified.endswith('nullable'):
|
||||
modified = 'nullable'
|
||||
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
|
||||
if column in insp.get_primary_keys(table) and new:
|
||||
return
|
||||
elif modified.endswith('default'):
|
||||
modified = 'server_default'
|
||||
if isinstance(new, six.string_types):
|
||||
new = text(new)
|
||||
kwargs = {modified: new, 'schema': schema}
|
||||
default = existing.get('existing_server_default')
|
||||
if default and isinstance(default, sa_schema.DefaultClause):
|
||||
if isinstance(default.arg, six.string_types):
|
||||
existing['existing_server_default'] = default.arg
|
||||
else:
|
||||
existing['existing_server_default'] = default.arg.text
|
||||
kwargs.update(existing)
|
||||
op.alter_column(table, column, **kwargs)
|
||||
|
||||
|
||||
def alembic_command_method(f):
|
||||
METHODS[f.__name__] = f
|
||||
return f
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def add_table(table):
|
||||
# Check if table has already exists and needs just to be renamed
|
||||
if not rename(table.name):
|
||||
table.create(bind=op.get_bind(), checkfirst=True)
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def add_index(index):
|
||||
bind = op.get_bind()
|
||||
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
|
||||
if index.name not in [idx['name'] for idx in
|
||||
insp.get_indexes(index.table.name)]:
|
||||
op.create_index(index.name, index.table.name, column_names(index))
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def remove_table(table):
|
||||
# Tables should not be removed
|
||||
pass
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def remove_index(index):
|
||||
bind = op.get_bind()
|
||||
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
|
||||
index_names = [idx['name'] for idx in insp.get_indexes(index.table.name)]
|
||||
fk_names = [i['name'] for i in insp.get_foreign_keys(index.table.name)]
|
||||
if index.name in index_names and index.name not in fk_names:
|
||||
op.drop_index(index.name, index.table.name)
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def remove_column(schema, table_name, column):
|
||||
op.drop_column(table_name, column.name, schema=schema)
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def add_column(schema, table_name, column):
|
||||
op.add_column(table_name, column.copy(), schema=schema)
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def add_constraint(constraint):
|
||||
op.create_unique_constraint(constraint.name, constraint.table.name,
|
||||
column_names(constraint))
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def remove_constraint(constraint):
|
||||
op.drop_constraint(constraint.name, constraint.table.name, type_='unique')
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def remove_fk(fk):
|
||||
op.drop_constraint(fk.name, fk.parent.name, type_='foreignkey')
|
||||
|
||||
|
||||
@alembic_command_method
|
||||
def add_fk(fk):
|
||||
fk_name = fk.name
|
||||
# As per Mike Bayer's comment, using _fk_spec method is preferable to
|
||||
# direct access to ForeignKeyConstraint attributes
|
||||
fk_spec = alembic.ddl.base._fk_spec(fk)
|
||||
fk_table = fk_spec[1]
|
||||
fk_ref = fk_spec[4]
|
||||
fk_local_cols = fk_spec[2]
|
||||
fk_remote_cols = fk_spec[5]
|
||||
op.create_foreign_key(fk_name, fk_table, fk_ref, fk_local_cols,
|
||||
fk_remote_cols)
|
||||
|
||||
|
||||
def check_if_table_exists(table):
|
||||
# This functions checks if table exists or not
|
||||
bind = op.get_bind()
|
||||
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
|
||||
return (table in insp.get_table_names() and
|
||||
table not in frozen_models.renamed_tables)
|
||||
|
||||
|
||||
def rename(table):
|
||||
# For tables that were renamed checks if the previous table exists
|
||||
# if it does the previous one will be renamed.
|
||||
# Returns True/False if it is needed to create new table
|
||||
if table in frozen_models.renamed_tables:
|
||||
if check_if_table_exists(frozen_models.renamed_tables[table]):
|
||||
op.rename_table(frozen_models.renamed_tables[table], table)
|
||||
LOG.info(_LI("Table %(old_t)r was renamed to %(new_t)r"), {
|
||||
'old_t': table, 'new_t': frozen_models.renamed_tables[table]})
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def column_names(obj):
|
||||
return [col.name for col in obj.columns if hasattr(col, 'name')]
|
||||
|
||||
|
||||
def _compare_type(ctxt, insp_col, meta_col, insp_type, meta_type):
|
||||
"""Return True if types are different, False if not.
|
||||
|
||||
Return None to allow the default implementation to compare these types.
|
||||
|
||||
:param ctxt: alembic MigrationContext instance
|
||||
:param insp_col: reflected column
|
||||
:param meta_col: column from model
|
||||
:param insp_type: reflected column type
|
||||
:param meta_type: column type from model
|
||||
|
||||
"""
|
||||
|
||||
# some backends (e.g. mysql) don't provide native boolean type
|
||||
BOOLEAN_METADATA = (types.BOOLEAN, types.Boolean)
|
||||
BOOLEAN_SQL = BOOLEAN_METADATA + (types.INTEGER, types.Integer)
|
||||
|
||||
if isinstance(meta_type, BOOLEAN_METADATA):
|
||||
return not isinstance(insp_type, BOOLEAN_SQL)
|
||||
|
||||
return None # tells alembic to use the default comparison method
|
||||
|
||||
|
||||
def _compare_server_default(ctxt, ins_col, meta_col, insp_def, meta_def,
|
||||
rendered_meta_def):
|
||||
"""Compare default values between model and db table.
|
||||
|
||||
Return True if the defaults are different, False if not, or None to
|
||||
allow the default implementation to compare these defaults.
|
||||
|
||||
:param ctxt: alembic MigrationContext instance
|
||||
:param insp_col: reflected column
|
||||
:param meta_col: column from model
|
||||
:param insp_def: reflected column default value
|
||||
:param meta_def: column default value from model
|
||||
:param rendered_meta_def: rendered column default value (from model)
|
||||
|
||||
"""
|
||||
|
||||
if (ctxt.dialect.name == 'mysql' and
|
||||
isinstance(meta_col.type, sqlalchemy.Boolean)):
|
||||
|
||||
if meta_def is None or insp_def is None:
|
||||
return meta_def != insp_def
|
||||
|
||||
return not (
|
||||
isinstance(meta_def.arg, expr.True_) and insp_def == "'1'" or
|
||||
isinstance(meta_def.arg, expr.False_) and insp_def == "'0'"
|
||||
)
|
||||
|
||||
return None # tells alembic to use the default comparison method
|
||||
|
||||
|
||||
def set_storage_engine(bind, engine):
|
||||
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
|
||||
if bind.dialect.name == 'mysql':
|
||||
for table in insp.get_table_names():
|
||||
if insp.get_table_options(table)['mysql_engine'] != engine:
|
||||
op.execute("ALTER TABLE %s ENGINE=%s" % (table, engine))
|
||||
@@ -18,6 +18,8 @@
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
l3_ha_states = sa.Enum('active', 'standby', name='l3_ha_states')
|
||||
|
||||
|
||||
def create_routerroutes():
|
||||
op.create_table(
|
||||
@@ -61,6 +63,8 @@ def upgrade():
|
||||
sa.Column('fixed_port_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('fixed_ip_address', sa.String(length=64), nullable=True),
|
||||
sa.Column('router_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('last_known_router_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('status', sa.String(length=16), nullable=True),
|
||||
sa.ForeignKeyConstraint(['fixed_port_id'], ['ports.id'], ),
|
||||
sa.ForeignKeyConstraint(['floating_port_id'], ['ports.id'], ),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ),
|
||||
@@ -70,11 +74,76 @@ def upgrade():
|
||||
|
||||
op.create_table(
|
||||
'routerl3agentbindings',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('router_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('l3_agent_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
sa.PrimaryKeyConstraint('router_id', 'l3_agent_id'))
|
||||
op.create_table(
|
||||
'router_extra_attributes',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('distributed', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.Column('service_router', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.Column('ha', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.Column('ha_vr_id', sa.Integer()),
|
||||
sa.ForeignKeyConstraint(
|
||||
['router_id'], ['routers.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id')
|
||||
)
|
||||
op.create_table('ha_router_agent_port_bindings',
|
||||
sa.Column('port_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('router_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('l3_agent_id', sa.String(length=36),
|
||||
nullable=True),
|
||||
sa.Column('state', l3_ha_states,
|
||||
server_default='standby'),
|
||||
sa.PrimaryKeyConstraint('port_id'),
|
||||
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
|
||||
ondelete='CASCADE'))
|
||||
|
||||
op.create_table('ha_router_networks',
|
||||
sa.Column('tenant_id', sa.String(length=255),
|
||||
nullable=False, primary_key=True),
|
||||
sa.Column('network_id', sa.String(length=36),
|
||||
nullable=False,
|
||||
primary_key=True),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
|
||||
ondelete='CASCADE'))
|
||||
|
||||
op.create_table('ha_router_vrid_allocations',
|
||||
sa.Column('network_id', sa.String(length=36),
|
||||
nullable=False,
|
||||
primary_key=True),
|
||||
sa.Column('vr_id', sa.Integer(),
|
||||
nullable=False,
|
||||
primary_key=True),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
|
||||
ondelete='CASCADE'))
|
||||
op.create_table(
|
||||
'routerports',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('port_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('port_type', sa.String(length=255)),
|
||||
sa.PrimaryKeyConstraint('router_id', 'port_id'),
|
||||
sa.ForeignKeyConstraint(
|
||||
['router_id'],
|
||||
['routers.id'],
|
||||
ondelete='CASCADE'
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
['port_id'],
|
||||
['ports.id'],
|
||||
ondelete='CASCADE'
|
||||
),
|
||||
)
|
||||
|
||||
@@ -108,12 +108,13 @@ def upgrade():
|
||||
sa.Column('weight', sa.Integer(), nullable=False),
|
||||
sa.Column('admin_state_up', sa.Boolean(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('pool_id', 'address', 'protocol_port',
|
||||
name='uniq_member0pool_id0address0port'))
|
||||
|
||||
op.create_table(
|
||||
'poolmonitorassociations',
|
||||
sa.Column('status', sa.String(length=16), nullable=False,
|
||||
server_default=''),
|
||||
sa.Column('status', sa.String(length=16), nullable=False),
|
||||
sa.Column('status_description', sa.String(length=255), nullable=True),
|
||||
sa.Column('pool_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('monitor_id', sa.String(length=36), nullable=False),
|
||||
@@ -124,9 +125,19 @@ def upgrade():
|
||||
op.create_table(
|
||||
'poolstatisticss',
|
||||
sa.Column('pool_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('bytes_in', sa.Integer(), nullable=False),
|
||||
sa.Column('bytes_out', sa.Integer(), nullable=False),
|
||||
sa.Column('active_connections', sa.Integer(), nullable=False),
|
||||
sa.Column('total_connections', sa.Integer(), nullable=False),
|
||||
sa.Column('bytes_in', sa.BigInteger(), nullable=False),
|
||||
sa.Column('bytes_out', sa.BigInteger(), nullable=False),
|
||||
sa.Column('active_connections', sa.BigInteger(), nullable=False),
|
||||
sa.Column('total_connections', sa.BigInteger(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ),
|
||||
sa.PrimaryKeyConstraint('pool_id'))
|
||||
|
||||
op.create_table(
|
||||
u'embrane_pool_port',
|
||||
sa.Column(u'pool_id', sa.String(length=36), nullable=False),
|
||||
sa.Column(u'port_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'],
|
||||
name=u'embrane_pool_port_ibfk_1'),
|
||||
sa.ForeignKeyConstraint(['port_id'], [u'ports.id'],
|
||||
name=u'embrane_pool_port_ibfk_2'),
|
||||
sa.PrimaryKeyConstraint(u'pool_id'))
|
||||
|
||||
@@ -31,6 +31,8 @@ def create_meteringlabels():
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.Column('description', sa.String(length=1024), nullable=True),
|
||||
sa.Column('shared', sa.Boolean(), server_default=sa.sql.false(),
|
||||
nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
|
||||
@@ -43,7 +45,8 @@ def upgrade():
|
||||
sa.Column('direction', direction, nullable=True),
|
||||
sa.Column('remote_ip_prefix', sa.String(length=64), nullable=True),
|
||||
sa.Column('metering_label_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('excluded', sa.Boolean(), nullable=True),
|
||||
sa.Column('excluded', sa.Boolean(), nullable=True,
|
||||
server_default=sa.sql.false()),
|
||||
sa.ForeignKeyConstraint(['metering_label_id'],
|
||||
['meteringlabels.id'],
|
||||
ondelete='CASCADE'),
|
||||
|
||||
@@ -20,18 +20,6 @@ from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def create_cisco_ml2_credentials():
|
||||
op.create_table(
|
||||
'cisco_ml2_credentials',
|
||||
sa.Column('credential_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('credential_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('user_name', sa.String(length=255), nullable=True),
|
||||
sa.Column('password', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('tenant_id', 'credential_name'),
|
||||
)
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'ml2_vlan_allocations',
|
||||
@@ -46,7 +34,7 @@ def upgrade():
|
||||
sa.Column('ip_address', sa.String(length=64), nullable=False),
|
||||
sa.Column('udp_port', sa.Integer(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.PrimaryKeyConstraint('ip_address', 'udp_port'))
|
||||
sa.PrimaryKeyConstraint('ip_address'))
|
||||
|
||||
op.create_table(
|
||||
'ml2_gre_endpoints',
|
||||
@@ -57,14 +45,16 @@ def upgrade():
|
||||
'ml2_vxlan_allocations',
|
||||
sa.Column('vxlan_vni', sa.Integer(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.PrimaryKeyConstraint('vxlan_vni'))
|
||||
|
||||
op.create_table(
|
||||
'ml2_gre_allocations',
|
||||
sa.Column('gre_id', sa.Integer(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.PrimaryKeyConstraint('gre_id'))
|
||||
|
||||
op.create_table(
|
||||
@@ -79,6 +69,8 @@ def upgrade():
|
||||
sa.Column('network_type', sa.String(length=32), nullable=False),
|
||||
sa.Column('physical_network', sa.String(length=64), nullable=True),
|
||||
sa.Column('segmentation_id', sa.Integer(), nullable=True),
|
||||
sa.Column('is_dynamic', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
@@ -86,11 +78,17 @@ def upgrade():
|
||||
op.create_table(
|
||||
'ml2_port_bindings',
|
||||
sa.Column('port_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('host', sa.String(length=255), nullable=False),
|
||||
sa.Column('host', sa.String(length=255), nullable=False,
|
||||
server_default=''),
|
||||
sa.Column('vif_type', sa.String(length=64), nullable=False),
|
||||
sa.Column('cap_port_filter', sa.Boolean(), nullable=False),
|
||||
sa.Column('driver', sa.String(length=64), nullable=True),
|
||||
sa.Column('segment', sa.String(length=36), nullable=True),
|
||||
sa.Column('vnic_type', sa.String(length=64), nullable=False,
|
||||
server_default='normal'),
|
||||
sa.Column('profile', sa.String(length=4095), nullable=False,
|
||||
server_default=''),
|
||||
sa.Column('vif_details', sa.String(length=4095), nullable=False,
|
||||
server_default=''),
|
||||
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['segment'], ['ml2_network_segments.id'],
|
||||
@@ -108,8 +106,6 @@ def upgrade():
|
||||
sa.PrimaryKeyConstraint('binding_id'),
|
||||
)
|
||||
|
||||
create_cisco_ml2_credentials()
|
||||
|
||||
op.create_table(
|
||||
'arista_provisioned_nets',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
|
||||
@@ -25,7 +25,8 @@ def upgrade():
|
||||
sa.Column('physical_network', sa.String(length=64), nullable=False),
|
||||
sa.Column('segmentation_id', sa.Integer(), autoincrement=False,
|
||||
nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False),
|
||||
sa.Column('allocated', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.PrimaryKeyConstraint('physical_network', 'segmentation_id'))
|
||||
|
||||
op.create_table(
|
||||
|
||||
@@ -24,15 +24,15 @@ def upgrade():
|
||||
op.create_table(
|
||||
'ofcportmappings',
|
||||
sa.Column('ofc_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('quantum_id'),
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('neutron_id'),
|
||||
sa.UniqueConstraint('ofc_id'))
|
||||
|
||||
op.create_table(
|
||||
'ofcroutermappings',
|
||||
sa.Column('ofc_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('quantum_id'),
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('neutron_id'),
|
||||
sa.UniqueConstraint('ofc_id'))
|
||||
|
||||
op.create_table(
|
||||
@@ -43,51 +43,27 @@ def upgrade():
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id'))
|
||||
|
||||
op.create_table(
|
||||
'ofcnetworks',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'ofctenantmappings',
|
||||
sa.Column('ofc_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('quantum_id'),
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('neutron_id'),
|
||||
sa.UniqueConstraint('ofc_id'))
|
||||
|
||||
op.create_table(
|
||||
'ofcfiltermappings',
|
||||
sa.Column('ofc_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('quantum_id'),
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('neutron_id'),
|
||||
sa.UniqueConstraint('ofc_id'))
|
||||
|
||||
op.create_table(
|
||||
'ofcnetworkmappings',
|
||||
sa.Column('ofc_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('quantum_id'),
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('neutron_id'),
|
||||
sa.UniqueConstraint('ofc_id'))
|
||||
|
||||
op.create_table(
|
||||
'ofcfilters',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'ofcports',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'ofctenants',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'packetfilters',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
|
||||
+17
-42
@@ -1,4 +1,4 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
# Copyright 2015 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@@ -13,33 +13,16 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nuage_initial
|
||||
|
||||
Revision ID: e766b19a3bb
|
||||
Revises: 1b2580001654
|
||||
Create Date: 2014-02-14 18:03:14.841064
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e766b19a3bb'
|
||||
down_revision = '1b2580001654'
|
||||
# Initial operations for Nuage plugin
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('routers'):
|
||||
# In the database we are migrating from, the configured plugin
|
||||
# did not create the routers table.
|
||||
return
|
||||
|
||||
op.create_table(
|
||||
'net_partitions',
|
||||
'nuage_net_partitions',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('name', sa.String(length=64), nullable=True),
|
||||
sa.Column('l3dom_tmplt_id', sa.String(length=36), nullable=True),
|
||||
@@ -47,17 +30,7 @@ def upgrade():
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
)
|
||||
op.create_table(
|
||||
'port_mapping',
|
||||
sa.Column('port_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nuage_vport_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('nuage_vif_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('static_ip', sa.Boolean(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('port_id'),
|
||||
)
|
||||
op.create_table(
|
||||
'subnet_l2dom_mapping',
|
||||
'nuage_subnet_l2dom_mapping',
|
||||
sa.Column('subnet_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('net_partition_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('nuage_subnet_id', sa.String(length=36), nullable=True),
|
||||
@@ -67,28 +40,30 @@ def upgrade():
|
||||
sa.Column('nuage_group_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['net_partition_id'], ['net_partitions.id'],
|
||||
sa.ForeignKeyConstraint(['net_partition_id'],
|
||||
['nuage_net_partitions.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('subnet_id'),
|
||||
)
|
||||
op.create_table(
|
||||
'net_partition_router_mapping',
|
||||
'nuage_net_partition_router_mapping',
|
||||
sa.Column('net_partition_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nuage_router_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['net_partition_id'], ['net_partitions.id'],
|
||||
sa.ForeignKeyConstraint(['net_partition_id'],
|
||||
['nuage_net_partitions.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('net_partition_id', 'router_id'),
|
||||
)
|
||||
op.create_table(
|
||||
'router_zone_mapping',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nuage_zone_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('nuage_user_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('nuage_group_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id'),
|
||||
'nuage_provider_net_bindings',
|
||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('network_type', sa.String(length=32), nullable=False),
|
||||
sa.Column('physical_network', sa.String(length=64), nullable=False),
|
||||
sa.Column('vlan_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
['network_id'], ['networks.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('network_id')
|
||||
)
|
||||
@@ -37,7 +37,8 @@ def upgrade():
|
||||
op.create_table(
|
||||
'quotas',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True,
|
||||
index=True),
|
||||
sa.Column('resource', sa.String(length=255), nullable=True),
|
||||
sa.Column('limit', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
@@ -79,3 +79,9 @@ def upgrade():
|
||||
sa.ForeignKeyConstraint(['rule_id'], ['routerrules.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('rule_id', 'nexthop'))
|
||||
|
||||
op.create_table(
|
||||
'consistencyhashes',
|
||||
sa.Column('hash_id', sa.String(255), primary_key=True),
|
||||
sa.Column('hash', sa.String(255), nullable=False)
|
||||
)
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nuage_extraroute
|
||||
|
||||
Revision ID: 10cd28e692e9
|
||||
Revises: 1b837a7125a9
|
||||
Create Date: 2014-05-14 14:47:53.148132
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '10cd28e692e9'
|
||||
down_revision = '1b837a7125a9'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
from neutron.db.migration.alembic_migrations import l3_init_ops
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('routers'):
|
||||
# In the database we are migrating from, the configured plugin
|
||||
# did not create the routers table.
|
||||
return
|
||||
|
||||
op.create_table(
|
||||
'routerroutes_mapping',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nuage_route_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
)
|
||||
# This table might already exist as it might have been created
|
||||
# if another plugin was configured before the nuage one
|
||||
if not migration.schema_has_table('routerroutes'):
|
||||
l3_init_ops.create_routerroutes()
|
||||
-174
@@ -1,174 +0,0 @@
|
||||
# Copyright 2014 NEC Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nec: delete old ofc mapping tables
|
||||
|
||||
Revision ID: 117643811bca
|
||||
Revises: 81c553f3776c
|
||||
Create Date: 2014-03-02 05:26:47.073318
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '117643811bca'
|
||||
down_revision = '81c553f3776c'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext import compiler as sa_compiler
|
||||
from sqlalchemy.sql import expression as sa_expr
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
# sqlalchemy does not support the expression:
|
||||
# INSERT INTO <table> (<column>, ...) (SELECT ...)
|
||||
# The following class is to support this expression.
|
||||
# Reference: http://docs.sqlalchemy.org/en/rel_0_9/core/compiler.html
|
||||
# section: "Compiling sub-elements of a custom expression construct"
|
||||
|
||||
class InsertFromSelect(sa_expr.Executable, sa_expr.ClauseElement):
|
||||
_execution_options = (sa_expr.Executable._execution_options.
|
||||
union({'autocommit': True}))
|
||||
|
||||
def __init__(self, insert_spec, select):
|
||||
self.insert_spec = insert_spec
|
||||
self.select = select
|
||||
|
||||
|
||||
@sa_compiler.compiles(InsertFromSelect)
|
||||
def visit_insert_from_select(element, compiler, **kw):
|
||||
if type(element.insert_spec) == list:
|
||||
columns = []
|
||||
for column in element.insert_spec:
|
||||
columns.append(column.name)
|
||||
table = compiler.process(element.insert_spec[0].table, asfrom=True)
|
||||
columns = ", ".join(columns)
|
||||
sql = ("INSERT INTO %s (%s) (%s)" %
|
||||
(table, columns, compiler.process(element.select)))
|
||||
else:
|
||||
sql = ("INSERT INTO %s (%s)" %
|
||||
(compiler.process(element.insert_spec, asfrom=True),
|
||||
compiler.process(element.select)))
|
||||
return sql
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Table definitions below are only used for sqlalchemy to generate
|
||||
# SQL statements, so in networks/ports tables only required field
|
||||
# are declared. Note that 'quantum_id' in OFC ID mapping tables
|
||||
# will be renamed in a later patch (bug 1287432).
|
||||
|
||||
if not migration.schema_has_table('ofctenants'):
|
||||
# Assume that, in the database we are migrating from, the
|
||||
# configured plugin did not create any ofc tables.
|
||||
return
|
||||
|
||||
ofctenants = sa_expr.table(
|
||||
'ofctenants',
|
||||
sa_expr.column('id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
ofcnetworks = sa_expr.table(
|
||||
'ofcnetworks',
|
||||
sa_expr.column('id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
ofcports = sa_expr.table(
|
||||
'ofcports',
|
||||
sa_expr.column('id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
ofcfilters = sa_expr.table(
|
||||
'ofcfilters',
|
||||
sa_expr.column('id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
|
||||
ofctenantmappings = sa_expr.table(
|
||||
'ofctenantmappings',
|
||||
sa_expr.column('ofc_id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
ofcnetworkmappings = sa_expr.table(
|
||||
'ofcnetworkmappings',
|
||||
sa_expr.column('ofc_id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
ofcportmappings = sa_expr.table(
|
||||
'ofcportmappings',
|
||||
sa_expr.column('ofc_id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
ofcfiltermappings = sa_expr.table(
|
||||
'ofcfiltermappings',
|
||||
sa_expr.column('ofc_id'),
|
||||
sa_expr.column('quantum_id'))
|
||||
|
||||
networks = sa_expr.table(
|
||||
'networks',
|
||||
sa_expr.column('id'),
|
||||
sa_expr.column('tenant_id'))
|
||||
ports = sa_expr.table(
|
||||
'ports',
|
||||
sa_expr.column('id'),
|
||||
sa_expr.column('network_id'))
|
||||
|
||||
# ofctenants -> ofctenantmappings
|
||||
select_obj = sa.select([ofctenants.c.quantum_id,
|
||||
op.inline_literal('/tenants/') + ofctenants.c.id])
|
||||
stmt = InsertFromSelect([ofctenantmappings.c.quantum_id,
|
||||
ofctenantmappings.c.ofc_id],
|
||||
select_obj)
|
||||
op.execute(stmt)
|
||||
|
||||
# ofcnetworks -> ofcnetworkmappings
|
||||
select_obj = ofcnetworks.join(
|
||||
networks,
|
||||
ofcnetworks.c.quantum_id == networks.c.id)
|
||||
select_obj = select_obj.join(
|
||||
ofctenantmappings,
|
||||
ofctenantmappings.c.quantum_id == networks.c.tenant_id)
|
||||
select_obj = sa.select(
|
||||
[ofcnetworks.c.quantum_id,
|
||||
(ofctenantmappings.c.ofc_id +
|
||||
op.inline_literal('/networks/') + ofcnetworks.c.id)],
|
||||
from_obj=select_obj)
|
||||
stmt = InsertFromSelect([ofcnetworkmappings.c.quantum_id,
|
||||
ofcnetworkmappings.c.ofc_id],
|
||||
select_obj)
|
||||
op.execute(stmt)
|
||||
|
||||
# ofcports -> ofcportmappings
|
||||
select_obj = ofcports.join(ports, ofcports.c.quantum_id == ports.c.id)
|
||||
select_obj = select_obj.join(
|
||||
ofcnetworkmappings,
|
||||
ofcnetworkmappings.c.quantum_id == ports.c.network_id)
|
||||
select_obj = sa.select(
|
||||
[ofcports.c.quantum_id,
|
||||
(ofcnetworkmappings.c.ofc_id +
|
||||
op.inline_literal('/ports/') + ofcports.c.id)],
|
||||
from_obj=select_obj)
|
||||
stmt = InsertFromSelect([ofcportmappings.c.quantum_id,
|
||||
ofcportmappings.c.ofc_id],
|
||||
select_obj)
|
||||
op.execute(stmt)
|
||||
|
||||
# ofcfilters -> ofcfiltermappings
|
||||
select_obj = sa.select([ofcfilters.c.quantum_id,
|
||||
op.inline_literal('/filters/') + ofcfilters.c.id])
|
||||
stmt = InsertFromSelect([ofcfiltermappings.c.quantum_id,
|
||||
ofcfiltermappings.c.ofc_id],
|
||||
select_obj)
|
||||
op.execute(stmt)
|
||||
|
||||
# drop old mapping tables
|
||||
op.drop_table('ofctenants')
|
||||
op.drop_table('ofcnetworks')
|
||||
op.drop_table('ofcports')
|
||||
op.drop_table('ofcfilters')
|
||||
@@ -1,54 +0,0 @@
|
||||
# Copyright 2014 VMware, Inc.
|
||||
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""NSX DHCP/metadata support
|
||||
|
||||
Revision ID: 1421183d533f
|
||||
Revises: 50e86cb2637a
|
||||
Create Date: 2013-10-11 14:33:37.303215
|
||||
|
||||
"""
|
||||
|
||||
revision = '1421183d533f'
|
||||
down_revision = '50e86cb2637a'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'lsn',
|
||||
sa.Column('net_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.Column('lsn_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('lsn_id'))
|
||||
|
||||
op.create_table(
|
||||
'lsn_port',
|
||||
sa.Column('lsn_port_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.Column('lsn_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.Column('sub_id',
|
||||
sa.String(length=36), nullable=False, unique=True),
|
||||
sa.Column('mac_addr',
|
||||
sa.String(length=32), nullable=False, unique=True),
|
||||
sa.ForeignKeyConstraint(['lsn_id'], ['lsn.lsn_id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('lsn_port_id'))
|
||||
@@ -1,38 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""ml2 binding:profile
|
||||
|
||||
Revision ID: 157a5d299379
|
||||
Revises: 50d5ba354c23
|
||||
Create Date: 2014-02-13 23:48:25.147279
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '157a5d299379'
|
||||
down_revision = '50d5ba354c23'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
if migration.schema_has_table('ml2_port_bindings'):
|
||||
op.add_column('ml2_port_bindings',
|
||||
sa.Column('profile', sa.String(length=4095),
|
||||
nullable=False, server_default=''))
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Remove Cisco Nexus Monolithic Plugin
|
||||
|
||||
Revision ID: 1680e1f0c4dc
|
||||
Revises: 3c346828361e
|
||||
Create Date: 2014-08-31 08:58:37.123992
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1680e1f0c4dc'
|
||||
down_revision = '3c346828361e'
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute('INSERT INTO cisco_ml2_nexusport_bindings (port_id, '
|
||||
'vlan_id, switch_ip, instance_id) SELECT '
|
||||
'port_id, vlan_id, switch_ip, instance_id FROM '
|
||||
'cisco_nexusport_bindings')
|
||||
op.drop_table('cisco_nexusport_bindings')
|
||||
@@ -1,77 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""ext_l3_ha_mode
|
||||
|
||||
Revision ID: 16a27a58e093
|
||||
Revises: 86d6d9776e2b
|
||||
Create Date: 2014-02-01 10:24:12.412733
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '16a27a58e093'
|
||||
down_revision = '86d6d9776e2b'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
l3_ha_states = sa.Enum('active', 'standby', name='l3_ha_states')
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.add_column('router_extra_attributes',
|
||||
sa.Column('ha', sa.Boolean(),
|
||||
nullable=False,
|
||||
server_default=sa.sql.false()))
|
||||
op.add_column('router_extra_attributes',
|
||||
sa.Column('ha_vr_id', sa.Integer()))
|
||||
|
||||
op.create_table('ha_router_agent_port_bindings',
|
||||
sa.Column('port_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('router_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('l3_agent_id', sa.String(length=36),
|
||||
nullable=True),
|
||||
sa.Column('state', l3_ha_states,
|
||||
server_default='standby'),
|
||||
sa.PrimaryKeyConstraint('port_id'),
|
||||
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
|
||||
ondelete='CASCADE'))
|
||||
|
||||
op.create_table('ha_router_networks',
|
||||
sa.Column('tenant_id', sa.String(length=255),
|
||||
nullable=False, primary_key=True),
|
||||
sa.Column('network_id', sa.String(length=36),
|
||||
nullable=False,
|
||||
primary_key=True),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
|
||||
ondelete='CASCADE'))
|
||||
|
||||
op.create_table('ha_router_vrid_allocations',
|
||||
sa.Column('network_id', sa.String(length=36),
|
||||
nullable=False,
|
||||
primary_key=True),
|
||||
sa.Column('vr_id', sa.Integer(),
|
||||
nullable=False,
|
||||
primary_key=True),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
|
||||
ondelete='CASCADE'))
|
||||
@@ -1,72 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nsx_gw_devices
|
||||
|
||||
Revision ID: 19180cf98af6
|
||||
Revises: 117643811bca
|
||||
Create Date: 2014-02-26 02:46:26.151741
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '19180cf98af6'
|
||||
down_revision = '117643811bca'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('networkgatewaydevices'):
|
||||
# Assume that, in the database we are migrating from, the
|
||||
# configured plugin did not create any nsx tables.
|
||||
return
|
||||
|
||||
op.create_table(
|
||||
'networkgatewaydevicereferences',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('interface_name', sa.String(length=64), nullable=True),
|
||||
sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id', 'network_gateway_id', 'interface_name'))
|
||||
# Copy data from networkgatewaydevices into networkgatewaydevicereference
|
||||
op.execute("INSERT INTO networkgatewaydevicereferences SELECT "
|
||||
"id, network_gateway_id, interface_name FROM "
|
||||
"networkgatewaydevices")
|
||||
# drop networkgatewaydevices
|
||||
op.drop_table('networkgatewaydevices')
|
||||
op.create_table(
|
||||
'networkgatewaydevices',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.Column('connector_type', sa.String(length=10), nullable=True),
|
||||
sa.Column('connector_ip', sa.String(length=64), nullable=True),
|
||||
sa.Column('status', sa.String(length=16), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
# Create a networkgatewaydevice for each existing reference.
|
||||
# For existing references nsx_id == neutron_id
|
||||
# Do not fill conenctor info as they would be unknown
|
||||
op.execute("INSERT INTO networkgatewaydevices (id, nsx_id, tenant_id) "
|
||||
"SELECT gw_dev_ref.id, gw_dev_ref.id as nsx_id, tenant_id "
|
||||
"FROM networkgatewaydevicereferences AS gw_dev_ref "
|
||||
"INNER JOIN networkgateways AS net_gw ON "
|
||||
"gw_dev_ref.network_gateway_id=net_gw.id")
|
||||
@@ -1,50 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nsx_sec_group_mapping
|
||||
|
||||
Revision ID: 1b2580001654
|
||||
Revises: abc88c33f74f
|
||||
Create Date: 2013-12-27 13:02:42.894648
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1b2580001654'
|
||||
down_revision = 'abc88c33f74f'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('securitygroups'):
|
||||
# Assume that, in the database we are migrating from, the
|
||||
# configured plugin did not create the securitygroups table.
|
||||
return
|
||||
|
||||
# Create table for security group mappings
|
||||
op.create_table(
|
||||
'neutron_nsx_security_group_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['securitygroups.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('neutron_id', 'nsx_id'))
|
||||
# Execute statement to add a record in security group mappings for
|
||||
# each record in securitygroups
|
||||
op.execute("INSERT INTO neutron_nsx_security_group_mappings SELECT id,id "
|
||||
"from securitygroups")
|
||||
@@ -1,57 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Cisco APIC Mechanism Driver
|
||||
|
||||
Revision ID: 1b837a7125a9
|
||||
Revises: 6be312499f9
|
||||
Create Date: 2014-02-13 09:35:19.147619
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1b837a7125a9'
|
||||
down_revision = '6be312499f9'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_epgs',
|
||||
sa.Column('network_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('epg_id', sa.String(length=64), nullable=False),
|
||||
sa.Column('segmentation_id', sa.String(length=64), nullable=False),
|
||||
sa.Column('provider', sa.Boolean(), default=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('network_id'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_port_profiles',
|
||||
sa.Column('node_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('profile_id', sa.String(length=64), nullable=False),
|
||||
sa.Column('hpselc_id', sa.String(length=64), nullable=False),
|
||||
sa.Column('module', sa.String(length=10), nullable=False),
|
||||
sa.Column('from_port', sa.Integer(), nullable=False),
|
||||
sa.Column('to_port', sa.Integer(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('node_id'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_contracts',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=False),
|
||||
sa.Column('contract_id', sa.String(length=64), nullable=False),
|
||||
sa.Column('filter_id', sa.String(length=64), nullable=False),
|
||||
sa.PrimaryKeyConstraint('tenant_id'))
|
||||
@@ -1,32 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Include all tables and make migrations unconditional.
|
||||
|
||||
Revision ID: db_healing
|
||||
Revises: 5446f2a45467
|
||||
Create Date: 2014-05-29 10:52:43.898980
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'db_healing'
|
||||
down_revision = '5446f2a45467'
|
||||
|
||||
from neutron.db.migration.alembic_migrations import heal_script
|
||||
|
||||
|
||||
def upgrade():
|
||||
heal_script.heal()
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_not_null_fields_lb_stats
|
||||
|
||||
Revision ID: 1e5dd1d09b22
|
||||
Revises: 54f7549a0e5f
|
||||
Create Date: 2014-03-17 11:00:35.370618
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1e5dd1d09b22'
|
||||
down_revision = '54f7549a0e5f'
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
@migration.skip_if_offline
|
||||
def upgrade():
|
||||
migration.alter_column_if_exists(
|
||||
'poolstatisticss', 'bytes_in',
|
||||
nullable=False,
|
||||
existing_type=sa.BigInteger())
|
||||
migration.alter_column_if_exists(
|
||||
'poolstatisticss', 'bytes_out',
|
||||
nullable=False,
|
||||
existing_type=sa.BigInteger())
|
||||
migration.alter_column_if_exists(
|
||||
'poolstatisticss', 'active_connections',
|
||||
nullable=False,
|
||||
existing_type=sa.BigInteger())
|
||||
migration.alter_column_if_exists(
|
||||
'poolstatisticss', 'total_connections',
|
||||
nullable=False,
|
||||
existing_type=sa.BigInteger())
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
# Copyright 2013 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Add a unique constraint on (agent_type, host) columns to prevent a race
|
||||
condition when an agent entry is 'upserted'.
|
||||
|
||||
Revision ID: 1fcfc149aca4
|
||||
Revises: e197124d4b9
|
||||
Create Date: 2013-11-27 18:35:28.148680
|
||||
|
||||
"""
|
||||
|
||||
revision = '1fcfc149aca4'
|
||||
down_revision = 'e197124d4b9'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
TABLE_NAME = 'agents'
|
||||
UC_NAME = 'uniq_agents0agent_type0host'
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table(TABLE_NAME):
|
||||
# Assume that, in the database we are migrating from, the
|
||||
# configured plugin did not create the agents table.
|
||||
return
|
||||
|
||||
op.create_unique_constraint(
|
||||
name=UC_NAME,
|
||||
source=TABLE_NAME,
|
||||
local_cols=['agent_type', 'host']
|
||||
)
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""ml2_type_driver_refactor_dynamic_segments
|
||||
|
||||
Revision ID: 236b90af57ab
|
||||
Revises: 58fe87a01143
|
||||
Create Date: 2014-08-14 16:22:14.293788
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '236b90af57ab'
|
||||
down_revision = '58fe87a01143'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
op.add_column('ml2_network_segments',
|
||||
sa.Column('is_dynamic', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()))
|
||||
@@ -1,55 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Add IPv6 Subnet properties
|
||||
|
||||
Revision ID: 2447ad0e9585
|
||||
Revises: 33dd0a9fa487
|
||||
Create Date: 2013-10-23 16:36:44.188904
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2447ad0e9585'
|
||||
down_revision = '33dd0a9fa487'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Workaround for Alembic bug #89
|
||||
# https://bitbucket.org/zzzeek/alembic/issue/89
|
||||
context = op.get_context()
|
||||
if context.bind.dialect.name == 'postgresql':
|
||||
op.execute("CREATE TYPE ipv6_ra_modes AS ENUM ('%s', '%s', '%s')"
|
||||
% ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless'))
|
||||
op.execute("CREATE TYPE ipv6_address_modes AS ENUM ('%s', '%s', '%s')"
|
||||
% ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless'))
|
||||
op.add_column('subnets',
|
||||
sa.Column('ipv6_ra_mode',
|
||||
sa.Enum('slaac',
|
||||
'dhcpv6-stateful',
|
||||
'dhcpv6-stateless',
|
||||
name='ipv6_ra_modes'),
|
||||
nullable=True)
|
||||
)
|
||||
op.add_column('subnets',
|
||||
sa.Column('ipv6_address_mode',
|
||||
sa.Enum('slaac',
|
||||
'dhcpv6-stateful',
|
||||
'dhcpv6-stateless',
|
||||
name='ipv6_address_modes'),
|
||||
nullable=True)
|
||||
)
|
||||
@@ -1,47 +0,0 @@
|
||||
# Copyright 2014 Cisco Systems, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Cisco CSR VPNaaS
|
||||
|
||||
Revision ID: 24c7ea5160d7
|
||||
Revises: 492a106273f8
|
||||
Create Date: 2014-02-03 13:06:50.407601
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '24c7ea5160d7'
|
||||
down_revision = '492a106273f8'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
if not migration.schema_has_table('ipsec_site_connections'):
|
||||
# The vpnaas service plugin was not configured.
|
||||
return
|
||||
op.create_table(
|
||||
'cisco_csr_identifier_map',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('ipsec_site_conn_id', sa.String(length=64),
|
||||
primary_key=True),
|
||||
sa.Column('csr_tunnel_id', sa.Integer(), nullable=False),
|
||||
sa.Column('csr_ike_policy_id', sa.Integer(), nullable=False),
|
||||
sa.Column('csr_ipsec_policy_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['ipsec_site_conn_id'],
|
||||
['ipsec_site_connections.id'],
|
||||
ondelete='CASCADE')
|
||||
)
|
||||
@@ -1,39 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""ml2_vnic_type
|
||||
|
||||
Revision ID: 27cc183af192
|
||||
Revises: 4ca36cfc898c
|
||||
Create Date: 2014-02-09 12:19:21.362967
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '27cc183af192'
|
||||
down_revision = '4ca36cfc898c'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
if migration.schema_has_table('ml2_port_bindings'):
|
||||
op.add_column('ml2_port_bindings',
|
||||
sa.Column('vnic_type', sa.String(length=64),
|
||||
nullable=False,
|
||||
server_default='normal'))
|
||||
@@ -1,80 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nuage_floatingip
|
||||
|
||||
Revision ID: 2db5203cb7a9
|
||||
Revises: 10cd28e692e9
|
||||
Create Date: 2014-05-19 16:39:42.048125
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2db5203cb7a9'
|
||||
down_revision = '10cd28e692e9'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
# This migration will be executed only if the neutron DB schema contains
|
||||
# the tables for the nuage plugin.
|
||||
# This migration will be skipped when executed in offline mode.
|
||||
|
||||
|
||||
@migration.skip_if_offline
|
||||
def upgrade():
|
||||
# These tables will be created even if the nuage plugin is not enabled.
|
||||
# This is fine as they would be created anyway by the healing migration.
|
||||
if migration.schema_has_table('routers'):
|
||||
# In the database we are migrating from, the configured plugin
|
||||
# did not create the routers table.
|
||||
op.create_table(
|
||||
'nuage_floatingip_pool_mapping',
|
||||
sa.Column('fip_pool_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('net_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('router_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['net_id'], ['networks.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('fip_pool_id'),
|
||||
)
|
||||
if migration.schema_has_table('floatingips'):
|
||||
# In the database we are migrating from, the configured plugin
|
||||
# did not create the floatingips table.
|
||||
op.create_table(
|
||||
'nuage_floatingip_mapping',
|
||||
sa.Column('fip_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('router_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('nuage_fip_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['fip_id'], ['floatingips.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('fip_id'),
|
||||
)
|
||||
migration.rename_table_if_exists('net_partitions',
|
||||
'nuage_net_partitions')
|
||||
migration.rename_table_if_exists('net_partition_router_mapping',
|
||||
'nuage_net_partition_router_mapping')
|
||||
migration.rename_table_if_exists('router_zone_mapping',
|
||||
'nuage_router_zone_mapping')
|
||||
migration.rename_table_if_exists('subnet_l2dom_mapping',
|
||||
'nuage_subnet_l2dom_mapping')
|
||||
migration.rename_table_if_exists('port_mapping',
|
||||
'nuage_port_mapping')
|
||||
migration.rename_table_if_exists('routerroutes_mapping',
|
||||
'nuage_routerroutes_mapping')
|
||||
@@ -1,48 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""floatingip_status
|
||||
|
||||
Revision ID: 2eeaf963a447
|
||||
Revises: e766b19a3bb
|
||||
Create Date: 2014-01-14 11:58:13.754747
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2eeaf963a447'
|
||||
down_revision = 'e766b19a3bb'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('floatingips'):
|
||||
# In the database we are migrating from, the configured plugin
|
||||
# did not create the floatingips table.
|
||||
return
|
||||
|
||||
op.add_column('floatingips',
|
||||
sa.Column('last_known_router_id',
|
||||
sa.String(length=36),
|
||||
nullable=True))
|
||||
op.add_column('floatingips',
|
||||
sa.Column('status',
|
||||
sa.String(length=16),
|
||||
nullable=True))
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""add constraint for routerid
|
||||
|
||||
Revision ID: 31d7f831a591
|
||||
Revises: 37f322991f59
|
||||
Create Date: 2014-02-26 06:47:16.494393
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '31d7f831a591'
|
||||
down_revision = '37f322991f59'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
TABLE_NAME = 'routerl3agentbindings'
|
||||
AGENTS_TABLE_NAME = 'agents'
|
||||
PK_NAME = 'pk_routerl3agentbindings'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# In order to sanitize the data during migration,
|
||||
# the current records in the table need to be verified
|
||||
# and all the duplicate records which violate the PK
|
||||
# constraint need to be removed.
|
||||
context = op.get_context()
|
||||
query_args = {'table': TABLE_NAME, 'agents_table': AGENTS_TABLE_NAME}
|
||||
if context.bind.dialect.name in ('postgresql', 'ibm_db_sa'):
|
||||
op.execute('DELETE FROM %(table)s WHERE id in ('
|
||||
'SELECT %(table)s.id FROM %(table)s LEFT OUTER JOIN '
|
||||
'(SELECT MIN(id) as id, router_id, l3_agent_id '
|
||||
' FROM %(table)s GROUP BY router_id, l3_agent_id) AS temp '
|
||||
'ON %(table)s.id = temp.id WHERE temp.id is NULL);'
|
||||
% query_args)
|
||||
else:
|
||||
op.execute('DELETE %(table)s FROM %(table)s LEFT OUTER JOIN '
|
||||
'(SELECT MIN(id) as id, router_id, l3_agent_id '
|
||||
' FROM %(table)s GROUP BY router_id, l3_agent_id) AS temp '
|
||||
'ON %(table)s.id = temp.id WHERE temp.id is NULL;'
|
||||
% query_args)
|
||||
# Remove orphaned records - bindings that reference non-existent agents
|
||||
op.execute('DELETE FROM %(table)s '
|
||||
'WHERE l3_agent_id NOT IN (select id from %(agents_table)s);'
|
||||
% query_args)
|
||||
|
||||
op.drop_column(TABLE_NAME, 'id')
|
||||
|
||||
with migration.remove_fks_from_table(TABLE_NAME):
|
||||
# DB2 doesn't support nullable column in primary key
|
||||
if context.bind.dialect.name == 'ibm_db_sa':
|
||||
op.alter_column(
|
||||
table_name=TABLE_NAME,
|
||||
column_name='router_id',
|
||||
nullable=False
|
||||
)
|
||||
op.alter_column(
|
||||
table_name=TABLE_NAME,
|
||||
column_name='l3_agent_id',
|
||||
nullable=False
|
||||
)
|
||||
|
||||
op.create_primary_key(
|
||||
name=PK_NAME,
|
||||
table_name=TABLE_NAME,
|
||||
cols=['router_id', 'l3_agent_id']
|
||||
)
|
||||
@@ -1,40 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_innodb_engine
|
||||
|
||||
Revision ID: 327ee5fde2c7
|
||||
Revises: 2026156eab2f
|
||||
Create Date: 2014-07-24 12:00:38.791287
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '327ee5fde2c7'
|
||||
down_revision = '4eba2f05c2f4'
|
||||
|
||||
|
||||
from alembic import op
|
||||
|
||||
# This list contain tables that could be deployed before change that converts
|
||||
# all tables to InnoDB appeared
|
||||
TABLES = ['router_extra_attributes', 'dvr_host_macs', 'ml2_dvr_port_bindings',
|
||||
'csnat_l3_agent_bindings']
|
||||
|
||||
|
||||
def upgrade():
|
||||
if op.get_bind().dialect.name == 'mysql':
|
||||
for table in TABLES:
|
||||
op.execute("ALTER TABLE %s ENGINE=InnoDB" % table)
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
""" cisco_apic_driver_update
|
||||
|
||||
Revision ID: 32f3915891fd
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '32f3915891fd'
|
||||
down_revision = 'aae5706a396'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
op.drop_table('cisco_ml2_apic_port_profiles')
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_host_links',
|
||||
sa.Column('host', sa.String(length=255), nullable=False),
|
||||
sa.Column('ifname', sa.String(length=64), nullable=False),
|
||||
sa.Column('ifmac', sa.String(length=32), nullable=True),
|
||||
sa.Column('swid', sa.String(length=32), nullable=False),
|
||||
sa.Column('module', sa.String(length=32), nullable=False),
|
||||
sa.Column('port', sa.String(length=32), nullable=False),
|
||||
sa.PrimaryKeyConstraint('host', 'ifname'))
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_names',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('neutron_type', sa.String(length=32), nullable=False),
|
||||
sa.Column('apic_name', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('neutron_id', 'neutron_type'))
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_length_of_description_field_metering
|
||||
|
||||
Revision ID: 33c3db036fe4
|
||||
Revises: b65aa907aec
|
||||
Create Date: 2014-03-25 11:04:27.341830
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '33c3db036fe4'
|
||||
down_revision = 'b65aa907aec'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
from neutron.db.migration.alembic_migrations import metering_init_ops
|
||||
|
||||
|
||||
def upgrade():
|
||||
if migration.schema_has_table('meteringlabels'):
|
||||
op.alter_column('meteringlabels', 'description', type_=sa.String(1024),
|
||||
existing_nullable=True)
|
||||
else:
|
||||
metering_init_ops.create_meteringlabels()
|
||||
@@ -1,46 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""embrane_lbaas_driver
|
||||
|
||||
Revision ID: 33dd0a9fa487
|
||||
Revises: 19180cf98af6
|
||||
Create Date: 2014-02-25 00:15:35.567111
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '33dd0a9fa487'
|
||||
down_revision = '19180cf98af6'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
if not migration.schema_has_table('pools'):
|
||||
# The lbaas service plugin was not configured.
|
||||
return
|
||||
op.create_table(
|
||||
u'embrane_pool_port',
|
||||
sa.Column(u'pool_id', sa.String(length=36), nullable=False),
|
||||
sa.Column(u'port_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'],
|
||||
name=u'embrane_pool_port_ibfk_1'),
|
||||
sa.ForeignKeyConstraint(['port_id'], [u'ports.id'],
|
||||
name=u'embrane_pool_port_ibfk_2'),
|
||||
sa.PrimaryKeyConstraint(u'pool_id'))
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""removing_mapping_tables
|
||||
|
||||
Revision ID: 37f322991f59
|
||||
Revises: 2026156eab2f
|
||||
Create Date: 2014-07-09 17:25:29.242948
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '37f322991f59'
|
||||
down_revision = '2026156eab2f'
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.drop_table('nuage_floatingip_mapping')
|
||||
op.drop_table('nuage_floatingip_pool_mapping')
|
||||
op.drop_table('nuage_routerroutes_mapping')
|
||||
op.drop_table('nuage_port_mapping')
|
||||
op.drop_table('nuage_router_zone_mapping')
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""L3 extension distributed mode
|
||||
|
||||
Revision ID: 3927f7f7c456
|
||||
Revises: db_healing
|
||||
Create Date: 2014-04-02 23:26:19.303633
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3927f7f7c456'
|
||||
down_revision = 'db_healing'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
context = op.get_context()
|
||||
op.create_table(
|
||||
'router_extra_attributes',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('distributed', sa.Boolean(), nullable=False,
|
||||
server_default=sa.sql.false()),
|
||||
sa.ForeignKeyConstraint(
|
||||
['router_id'], ['routers.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id')
|
||||
)
|
||||
if context.bind.dialect.name == 'ibm_db_sa':
|
||||
# NOTE(mriedem): DB2 stores booleans as 0 and 1.
|
||||
op.execute("INSERT INTO router_extra_attributes "
|
||||
"SELECT id as router_id, "
|
||||
"0 as distributed from routers")
|
||||
else:
|
||||
op.execute("INSERT INTO router_extra_attributes "
|
||||
"SELECT id as router_id, "
|
||||
"False as distributed from routers")
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Drop unused servicedefinitions and servicetypes tables.
|
||||
|
||||
These tables are created independently on plugins but only dropped if
|
||||
LoadBalancer plugin is used. Meaning that if LoadBalancer plugin is not set
|
||||
then these tables were created and never used.
|
||||
|
||||
Revision ID: 3b85b693a95f
|
||||
Revises: 327ee5fde2c7
|
||||
Create Date: 2014-07-22 03:30:05.837152
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3b85b693a95f'
|
||||
down_revision = '327ee5fde2c7'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
for table in ('servicedefinitions', 'servicetypes'):
|
||||
if migration.schema_has_table(table):
|
||||
op.drop_table(table)
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""metering_label_shared
|
||||
|
||||
Revision ID: 3c346828361e
|
||||
Revises: 16a27a58e093
|
||||
Create Date: 2014-08-27 15:03:46.537290
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3c346828361e'
|
||||
down_revision = '16a27a58e093'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('meteringlabels', sa.Column('shared', sa.Boolean(),
|
||||
server_default=sa.sql.false(),
|
||||
nullable=True))
|
||||
@@ -1,46 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""VMware NSX rebranding
|
||||
|
||||
Revision ID: 3d2585038b95
|
||||
Revises: 157a5d299379
|
||||
Create Date: 2014-02-11 18:18:34.319031
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3d2585038b95'
|
||||
down_revision = '157a5d299379'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('nvp_network_bindings'):
|
||||
# Assume that, in the database we are migrating from, the
|
||||
# configured plugin did not create any nvp tables.
|
||||
return
|
||||
|
||||
op.rename_table('nvp_network_bindings', 'tz_network_bindings')
|
||||
op.rename_table('nvp_multi_provider_networks', 'multi_provider_networks')
|
||||
|
||||
engine = op.get_bind().engine
|
||||
if engine.name == 'postgresql':
|
||||
op.execute("ALTER TYPE nvp_network_bindings_binding_type "
|
||||
"RENAME TO tz_network_bindings_binding_type;")
|
||||
@@ -1,40 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nsx_switch_mappings
|
||||
|
||||
Revision ID: 3d3cb89d84ee
|
||||
Revises: 1421183d533f
|
||||
Create Date: 2014-01-07 15:37:41.323020
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3d3cb89d84ee'
|
||||
down_revision = '1421183d533f'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Create table for network mappings
|
||||
op.create_table(
|
||||
'neutron_nsx_network_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['networks.id'],
|
||||
ondelete='CASCADE'),
|
||||
# There might be multiple switches for a neutron network
|
||||
sa.PrimaryKeyConstraint('neutron_id', 'nsx_id'),
|
||||
)
|
||||
@@ -1,51 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Brocade ML2 Mech. Driver
|
||||
|
||||
Revision ID: 492a106273f8
|
||||
Revises: 2eeaf963a447
|
||||
Create Date: 2014-03-03 15:35:46.974523
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '492a106273f8'
|
||||
down_revision = '2eeaf963a447'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'ml2_brocadenetworks',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('vlan', sa.String(length=10), nullable=True),
|
||||
sa.Column('segment_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('network_type', sa.String(length=10), nullable=True),
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'ml2_brocadeports',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('admin_state_up', sa.Boolean()),
|
||||
sa.Column('physical_interface', sa.String(length=36), nullable=True),
|
||||
sa.Column('vlan_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['ml2_brocadenetworks.id']))
|
||||
@@ -1,51 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nsx_router_mappings
|
||||
|
||||
Revision ID: 4ca36cfc898c
|
||||
Revises: 3d3cb89d84ee
|
||||
Create Date: 2014-01-08 10:41:43.373031
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4ca36cfc898c'
|
||||
down_revision = '3d3cb89d84ee'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('routers'):
|
||||
# In the database we are migrating from, the configured plugin
|
||||
# did not create the routers table.
|
||||
return
|
||||
|
||||
# Create table for router/lrouter mappings
|
||||
op.create_table(
|
||||
'neutron_nsx_router_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('neutron_id'),
|
||||
)
|
||||
# Execute statement to a record in nsx_router_mappings for
|
||||
# each record in routers
|
||||
op.execute("INSERT INTO neutron_nsx_router_mappings SELECT id,id "
|
||||
"from routers")
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2014 Thales Services SAS
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""correct Vxlan Endpoint primary key
|
||||
|
||||
Revision ID: 4eba2f05c2f4
|
||||
Revises: 884573acbf1c
|
||||
Create Date: 2014-07-07 22:48:38.544323
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4eba2f05c2f4'
|
||||
down_revision = '884573acbf1c'
|
||||
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
TABLE_NAME = 'ml2_vxlan_endpoints'
|
||||
PK_NAME = 'ml2_vxlan_endpoints_pkey'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.drop_constraint(PK_NAME, TABLE_NAME, type_='primary')
|
||||
op.create_primary_key(PK_NAME, TABLE_NAME, cols=['ip_address'])
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Remove ML2 Cisco Credentials DB
|
||||
|
||||
Revision ID: 4eca4a84f08a
|
||||
Revises: 33c3db036fe4
|
||||
Create Date: 2014-04-10 19:32:46.697189
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4eca4a84f08a'
|
||||
down_revision = '33c3db036fe4'
|
||||
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
TABLE = 'cisco_ml2_credentials'
|
||||
|
||||
|
||||
def upgrade():
|
||||
if migration.schema_has_table(TABLE):
|
||||
op.drop_table(TABLE)
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""ml2 binding:vif_details
|
||||
|
||||
Revision ID: 50d5ba354c23
|
||||
Revises: 27cc183af192
|
||||
Create Date: 2014-02-11 23:21:59.577972
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '50d5ba354c23'
|
||||
down_revision = '27cc183af192'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('ml2_port_bindings'):
|
||||
# In the database we are migrating from, the configured plugin
|
||||
# did not create the ml2_port_bindings table.
|
||||
return
|
||||
|
||||
op.add_column('ml2_port_bindings',
|
||||
sa.Column('vif_details', sa.String(length=4095),
|
||||
nullable=False, server_default=''))
|
||||
if op.get_bind().engine.name == 'ibm_db_sa':
|
||||
op.execute(
|
||||
"UPDATE ml2_port_bindings SET"
|
||||
" vif_details = '{\"port_filter\": true}'"
|
||||
" WHERE cap_port_filter = 1")
|
||||
op.execute(
|
||||
"UPDATE ml2_port_bindings SET"
|
||||
" vif_details = '{\"port_filter\": false}'"
|
||||
" WHERE cap_port_filter = 0")
|
||||
else:
|
||||
op.execute(
|
||||
"UPDATE ml2_port_bindings SET"
|
||||
" vif_details = '{\"port_filter\": true}'"
|
||||
" WHERE cap_port_filter = true")
|
||||
op.execute(
|
||||
"UPDATE ml2_port_bindings SET"
|
||||
" vif_details = '{\"port_filter\": false}'"
|
||||
" WHERE cap_port_filter = false")
|
||||
op.drop_column('ml2_port_bindings', 'cap_port_filter')
|
||||
if op.get_bind().engine.name == 'ibm_db_sa':
|
||||
op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
|
||||
@@ -1,51 +0,0 @@
|
||||
# Copyright 2013 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nsx_mappings
|
||||
|
||||
Revision ID: 50e86cb2637a
|
||||
Revises: 1fcfc149aca4
|
||||
Create Date: 2013-10-26 14:37:30.012149
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '50e86cb2637a'
|
||||
down_revision = '1fcfc149aca4'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('neutron_nsx_port_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('nsx_port_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('nsx_switch_id', sa.String(length=36),
|
||||
nullable=True),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('neutron_id'))
|
||||
|
||||
if migration.schema_has_table('quantum_nvp_port_mapping'):
|
||||
op.execute(
|
||||
"INSERT INTO neutron_nsx_port_mappings SELECT quantum_id as "
|
||||
"neutron_id, nvp_id as nsx_port_id, null as nsx_switch_id from"
|
||||
" quantum_nvp_port_mapping")
|
||||
op.drop_table('quantum_nvp_port_mapping')
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""NEC Rename quantum_id to neutron_id
|
||||
|
||||
Revision ID: 538732fa21e1
|
||||
Revises: 2447ad0e9585
|
||||
Create Date: 2014-03-04 05:43:33.660601
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '538732fa21e1'
|
||||
down_revision = '2447ad0e9585'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('ofctenantmappings'):
|
||||
# Assume that, in the database we are migrating from, the
|
||||
# configured plugin did not create any ofc tables.
|
||||
return
|
||||
|
||||
for table in ['ofctenantmappings', 'ofcnetworkmappings',
|
||||
'ofcportmappings', 'ofcfiltermappings',
|
||||
'ofcroutermappings',
|
||||
]:
|
||||
op.alter_column(table, 'quantum_id',
|
||||
new_column_name='neutron_id',
|
||||
existing_type=sa.String(length=36),
|
||||
existing_nullable=False)
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""add router port relationship
|
||||
|
||||
Revision ID: 544673ac99ab
|
||||
Revises: 1680e1f0c4dc
|
||||
Create Date: 2014-01-14 11:58:13.754747
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '544673ac99ab'
|
||||
down_revision = '1680e1f0c4dc'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
SQL_STATEMENT = (
|
||||
"insert into routerports "
|
||||
"select "
|
||||
"p.device_id as router_id, p.id as port_id, p.device_owner as port_type "
|
||||
"from ports p join routers r on (p.device_id=r.id) "
|
||||
"where "
|
||||
"(r.tenant_id=p.tenant_id AND p.device_owner='network:router_interface') "
|
||||
"OR (p.tenant_id='' AND p.device_owner='network:router_gateway')"
|
||||
)
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'routerports',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('port_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('port_type', sa.String(length=255)),
|
||||
sa.PrimaryKeyConstraint('router_id', 'port_id'),
|
||||
sa.ForeignKeyConstraint(
|
||||
['router_id'],
|
||||
['routers.id'],
|
||||
ondelete='CASCADE'
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
['port_id'],
|
||||
['ports.id'],
|
||||
ondelete='CASCADE'
|
||||
),
|
||||
)
|
||||
|
||||
op.execute(SQL_STATEMENT)
|
||||
@@ -1,139 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_server_default
|
||||
|
||||
Revision ID: 5446f2a45467
|
||||
Revises: 2db5203cb7a9
|
||||
Create Date: 2014-07-07 18:31:30.384522
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5446f2a45467'
|
||||
down_revision = '2db5203cb7a9'
|
||||
|
||||
|
||||
import sqlalchemy as sa
|
||||
import sqlalchemy.sql
|
||||
|
||||
from neutron.db import migration
|
||||
from neutron.plugins.cisco.common import cisco_constants
|
||||
|
||||
# This migration will be executed only if then Neutron db contains tables for
|
||||
# selected plugins and agents.
|
||||
# required tables and columns are:
|
||||
# brocade_ports.port_id
|
||||
# segmentation_id_llocation.allocated
|
||||
# cisco_n1kv_profile_bindings.tenant_id
|
||||
# cisco_network_profiles.multicast_ip_index
|
||||
# cisco_n1kv_vlan_allocations.allocated
|
||||
# nsxrouterextattributess.service_router
|
||||
# nsxrouterextattributess.distributed
|
||||
# qosqueues.default
|
||||
# agents.admin_state_up
|
||||
# ml2_gre_allocations.allocated
|
||||
# ml2_vxlan_allocations.allocated
|
||||
# This migration will be skipped when executed offline mode.
|
||||
|
||||
default = sqlalchemy.sql.false()
|
||||
|
||||
|
||||
def upgrade():
|
||||
run()
|
||||
|
||||
|
||||
@migration.skip_if_offline
|
||||
def run():
|
||||
set_default_ml2()
|
||||
set_default_mlnx()
|
||||
set_default_brocade()
|
||||
set_default_cisco()
|
||||
set_default_vmware()
|
||||
set_default_agents()
|
||||
|
||||
|
||||
def set_default_brocade():
|
||||
default = ''
|
||||
migration.alter_column_if_exists(
|
||||
'brocadeports', 'port_id',
|
||||
server_default=default,
|
||||
existing_type=sa.String(36))
|
||||
|
||||
|
||||
def set_default_mlnx():
|
||||
migration.alter_column_if_exists(
|
||||
'segmentation_id_allocation', 'allocated',
|
||||
server_default=default,
|
||||
existing_nullable=False,
|
||||
existing_type=sa.Boolean)
|
||||
|
||||
|
||||
def set_default_cisco():
|
||||
profile_binding_default = cisco_constants.TENANT_ID_NOT_SET
|
||||
profile_default = '0'
|
||||
migration.alter_column_if_exists(
|
||||
'cisco_n1kv_profile_bindings', 'tenant_id',
|
||||
existing_type=sa.String(length=36),
|
||||
server_default=profile_binding_default,
|
||||
existing_nullable=False)
|
||||
migration.alter_column_if_exists(
|
||||
'cisco_network_profiles', 'multicast_ip_index',
|
||||
server_default=profile_default,
|
||||
existing_type=sa.Integer)
|
||||
migration.alter_column_if_exists(
|
||||
'cisco_n1kv_vlan_allocations', 'allocated',
|
||||
existing_type=sa.Boolean,
|
||||
server_default=default,
|
||||
existing_nullable=False)
|
||||
|
||||
|
||||
def set_default_vmware():
|
||||
migration.alter_column_if_exists(
|
||||
'nsxrouterextattributess', 'service_router',
|
||||
server_default=default,
|
||||
existing_nullable=False,
|
||||
existing_type=sa.Boolean)
|
||||
migration.alter_column_if_exists(
|
||||
'nsxrouterextattributess', 'distributed',
|
||||
server_default=default,
|
||||
existing_nullable=False,
|
||||
existing_type=sa.Boolean)
|
||||
migration.alter_column_if_exists(
|
||||
'qosqueues', 'default',
|
||||
server_default=default,
|
||||
existing_type=sa.Boolean)
|
||||
|
||||
|
||||
def set_default_agents():
|
||||
default = sqlalchemy.sql.true()
|
||||
migration.alter_column_if_exists(
|
||||
'agents', 'admin_state_up',
|
||||
server_default=default,
|
||||
existing_nullable=False,
|
||||
existing_type=sa.Boolean)
|
||||
|
||||
|
||||
def set_default_ml2():
|
||||
migration.alter_column_if_exists(
|
||||
'ml2_gre_allocations', 'allocated',
|
||||
server_default=default,
|
||||
existing_nullable=False,
|
||||
existing_type=sa.Boolean)
|
||||
migration.alter_column_if_exists(
|
||||
'ml2_vxlan_allocations', 'allocated',
|
||||
server_default=default,
|
||||
existing_nullable=False,
|
||||
existing_type=sa.Boolean)
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_not_null_peer_address
|
||||
|
||||
Revision ID: 54f7549a0e5f
|
||||
Revises: 33dd0a9fa487
|
||||
Create Date: 2014-03-17 11:00:17.539028
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '54f7549a0e5f'
|
||||
down_revision = 'icehouse'
|
||||
|
||||
# This migration will be executed only if the neutron DB schema
|
||||
# contains the tables for VPN service plugin.
|
||||
# This migration will be skipped when executed in offline mode.
|
||||
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
@migration.skip_if_offline
|
||||
def upgrade():
|
||||
migration.alter_column_if_exists(
|
||||
'ipsec_site_connections', 'peer_address',
|
||||
existing_type=sa.String(255),
|
||||
nullable=False)
|
||||
@@ -1,46 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""L3 scheduler additions to support DVR
|
||||
|
||||
Revision ID: 5589aa32bf80
|
||||
Revises: 31d7f831a591
|
||||
Create Date: 2014-07-7 11:00:43.392912
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5589aa32bf80'
|
||||
down_revision = '31d7f831a591'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'csnat_l3_agent_bindings',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('l3_agent_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('host_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('csnat_gw_port_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['csnat_gw_port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id')
|
||||
)
|
||||
@@ -1,73 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""cisco_csr_routing
|
||||
|
||||
Revision ID: 58fe87a01143
|
||||
Revises: 32f3915891fd
|
||||
Create Date: 2014-08-18 17:14:12.506356
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '58fe87a01143'
|
||||
down_revision = '32f3915891fd'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('cisco_hosting_devices',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('complementary_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('device_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('admin_state_up', sa.Boolean(), nullable=False),
|
||||
sa.Column('management_port_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('protocol_port', sa.Integer(), nullable=True),
|
||||
sa.Column('cfg_agent_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('status', sa.String(length=16), nullable=True),
|
||||
sa.ForeignKeyConstraint(['cfg_agent_id'], ['agents.id'], ),
|
||||
sa.ForeignKeyConstraint(['management_port_id'], ['ports.id'],
|
||||
ondelete='SET NULL'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('cisco_port_mappings',
|
||||
sa.Column('logical_resource_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('logical_port_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('port_type', sa.String(length=32), nullable=True),
|
||||
sa.Column('network_type', sa.String(length=32), nullable=True),
|
||||
sa.Column('hosting_port_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('segmentation_id', sa.Integer(), autoincrement=False,
|
||||
nullable=True),
|
||||
sa.ForeignKeyConstraint(['hosting_port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['logical_port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('logical_resource_id', 'logical_port_id')
|
||||
)
|
||||
op.create_table('cisco_router_mappings',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('auto_schedule', sa.Boolean(), nullable=False),
|
||||
sa.Column('hosting_device_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['hosting_device_id'],
|
||||
['cisco_hosting_devices.id'],
|
||||
ondelete='SET NULL'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id')
|
||||
)
|
||||
@@ -1,66 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""n1kv segment allocs for cisco n1kv plugin
|
||||
|
||||
Revision ID: 5ac1c354a051
|
||||
Revises: 538732fa21e1
|
||||
Create Date: 2014-03-05 17:36:52.952608
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5ac1c354a051'
|
||||
down_revision = '538732fa21e1'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
if not migration.schema_has_table('cisco_n1kv_vlan_allocations'):
|
||||
# Assume that, in the database we are migrating from, the
|
||||
# configured plugin did not create any n1kv tables.
|
||||
return
|
||||
|
||||
op.add_column(
|
||||
'cisco_n1kv_vlan_allocations',
|
||||
sa.Column('network_profile_id',
|
||||
sa.String(length=36),
|
||||
nullable=False)
|
||||
)
|
||||
op.create_foreign_key(
|
||||
'cisco_n1kv_vlan_allocations_ibfk_1',
|
||||
source='cisco_n1kv_vlan_allocations',
|
||||
referent='cisco_network_profiles',
|
||||
local_cols=['network_profile_id'], remote_cols=['id'],
|
||||
ondelete='CASCADE'
|
||||
)
|
||||
op.add_column(
|
||||
'cisco_n1kv_vxlan_allocations',
|
||||
sa.Column('network_profile_id',
|
||||
sa.String(length=36),
|
||||
nullable=False)
|
||||
)
|
||||
op.create_foreign_key(
|
||||
'cisco_n1kv_vxlan_allocations_ibfk_1',
|
||||
source='cisco_n1kv_vxlan_allocations',
|
||||
referent='cisco_network_profiles',
|
||||
local_cols=['network_profile_id'], remote_cols=['id'],
|
||||
ondelete='CASCADE'
|
||||
)
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_not_null_vlan_id_cisco
|
||||
|
||||
Revision ID: 6be312499f9
|
||||
Revises: d06e871c0d5
|
||||
Create Date: 2014-03-27 14:38:12.571173
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6be312499f9'
|
||||
down_revision = 'd06e871c0d5'
|
||||
|
||||
# This migration will be executed only if the neutron DB schema
|
||||
# contains the tables for the cisco plugin.
|
||||
# This migration will be skipped when executed in offline mode.
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
@migration.skip_if_offline
|
||||
def upgrade():
|
||||
migration.alter_column_if_exists(
|
||||
'cisco_nexusport_bindings', 'vlan_id',
|
||||
nullable=False,
|
||||
existing_type=sa.Integer)
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""bsn_consistencyhashes
|
||||
|
||||
Revision ID: 81c553f3776c
|
||||
Revises: 24c7ea5160d7
|
||||
Create Date: 2014-02-26 18:56:00.402855
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '81c553f3776c'
|
||||
down_revision = '24c7ea5160d7'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'consistencyhashes',
|
||||
sa.Column('hash_id', sa.String(255), primary_key=True),
|
||||
sa.Column('hash', sa.String(255), nullable=False)
|
||||
)
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Cisco APIC Mechanism Driver
|
||||
|
||||
Revision ID: 86d6d9776e2b
|
||||
Revises: 236b90af57abg
|
||||
Create Date: 2014-04-23 09:27:08.177021
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '86d6d9776e2b'
|
||||
down_revision = '236b90af57ab'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
|
||||
op.drop_table('cisco_ml2_apic_contracts')
|
||||
op.drop_table('cisco_ml2_apic_epgs')
|
||||
|
||||
op.create_table(
|
||||
'cisco_ml2_apic_contracts',
|
||||
sa.Column('tenant_id', sa.String(length=255)),
|
||||
sa.Column('router_id', sa.String(length=64), nullable=False),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id']),
|
||||
sa.PrimaryKeyConstraint('router_id'))
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Drop NSX table in favor of the extra_attributes one
|
||||
|
||||
Revision ID: 884573acbf1c
|
||||
Revises: 5589aa32bf80
|
||||
Create Date: 2013-01-07 13:47:29.093160
|
||||
|
||||
"""
|
||||
|
||||
revision = '884573acbf1c'
|
||||
down_revision = '5589aa32bf80'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def _migrate_data(old_table, new_table):
|
||||
engine = op.get_bind().engine
|
||||
if engine.name == 'postgresql':
|
||||
op.execute(("UPDATE %(new_table)s new_t "
|
||||
"SET distributed = old_t.distributed, "
|
||||
"service_router = old_t.service_router "
|
||||
"FROM %(old_table)s old_t "
|
||||
"WHERE new_t.router_id = old_t.router_id") %
|
||||
{'new_table': new_table, 'old_table': old_table})
|
||||
elif engine.name == 'ibm_db_sa':
|
||||
op.execute(("UPDATE %(new_table)s new_t "
|
||||
"SET (distributed, service_router) = "
|
||||
"(SELECT old_t.distributed, old_t.service_router "
|
||||
"FROM %(old_table)s old_t "
|
||||
"WHERE new_t.router_id = old_t.router_id)") %
|
||||
{'new_table': new_table, 'old_table': old_table})
|
||||
else:
|
||||
op.execute(("UPDATE %(new_table)s new_t "
|
||||
"INNER JOIN %(old_table)s as old_t "
|
||||
"ON new_t.router_id = old_t.router_id "
|
||||
"SET new_t.distributed = old_t.distributed, "
|
||||
"new_t.service_router = old_t.service_router") %
|
||||
{'new_table': new_table, 'old_table': old_table})
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('router_extra_attributes',
|
||||
sa.Column('service_router', sa.Boolean(),
|
||||
nullable=False,
|
||||
server_default=sa.sql.false()))
|
||||
_migrate_data('router_extra_attributes', 'nsxrouterextattributess')
|
||||
op.drop_table('nsxrouterextattributess')
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""nuage_provider_networks
|
||||
|
||||
Revision ID: aae5706a396
|
||||
Revises: 3b85b693a95f
|
||||
Create Date: 2014-08-18 16:00:21.898795
|
||||
|
||||
"""
|
||||
|
||||
revision = 'aae5706a396'
|
||||
down_revision = '3b85b693a95f'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'nuage_provider_net_bindings',
|
||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('network_type', sa.String(length=32), nullable=False),
|
||||
sa.Column('physical_network', sa.String(length=64), nullable=False),
|
||||
sa.Column('vlan_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
['network_id'], ['networks.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('network_id')
|
||||
)
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""lb stats
|
||||
|
||||
Revision ID: abc88c33f74f
|
||||
Revises: 3d2585038b95
|
||||
Create Date: 2014-02-24 20:14:59.577972
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'abc88c33f74f'
|
||||
down_revision = '3d2585038b95'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
if migration.schema_has_table('poolstatisticss'):
|
||||
op.alter_column('poolstatisticss', 'bytes_in',
|
||||
type_=sa.BigInteger(), existing_type=sa.Integer())
|
||||
op.alter_column('poolstatisticss', 'bytes_out',
|
||||
type_=sa.BigInteger(), existing_type=sa.Integer())
|
||||
op.alter_column('poolstatisticss', 'active_connections',
|
||||
type_=sa.BigInteger(), existing_type=sa.Integer())
|
||||
op.alter_column('poolstatisticss', 'total_connections',
|
||||
type_=sa.BigInteger(), existing_type=sa.Integer())
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_length_of_protocol_field
|
||||
|
||||
Revision ID: b65aa907aec
|
||||
Revises: 1e5dd1d09b22
|
||||
Create Date: 2014-03-21 16:30:10.626649
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b65aa907aec'
|
||||
down_revision = '1e5dd1d09b22'
|
||||
|
||||
# This migration will be executed only if then Neutron db contains tables for
|
||||
# the firewall service plugin
|
||||
# This migration will not be executed in offline mode
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
@migration.skip_if_offline
|
||||
def upgrade():
|
||||
migration.alter_column_if_exists(
|
||||
'firewall_rules', 'protocol',
|
||||
type_=sa.String(40),
|
||||
existing_nullable=True)
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""set_admin_state_up_not_null_ml2
|
||||
|
||||
Revision ID: d06e871c0d5
|
||||
Revises: 2447ad0e9585
|
||||
Create Date: 2014-03-21 17:22:20.545186
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd06e871c0d5'
|
||||
down_revision = '4eca4a84f08a'
|
||||
|
||||
# This migration will be executed only if the neutron DB schema
|
||||
# contains the tables for the ML2 plugin brocade driver.
|
||||
# This migration will be skipped when executed in offline mode.
|
||||
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
@migration.skip_if_offline
|
||||
def upgrade():
|
||||
migration.alter_column_if_exists(
|
||||
'ml2_brocadeports', 'admin_state_up',
|
||||
nullable=False,
|
||||
existing_type=sa.Boolean)
|
||||
@@ -1,43 +0,0 @@
|
||||
# Copyright 2013 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""add unique constraint to members
|
||||
|
||||
Revision ID: e197124d4b9
|
||||
Revises: havana
|
||||
Create Date: 2013-11-17 10:09:37.728903
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e197124d4b9'
|
||||
down_revision = 'havana'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
CONSTRAINT_NAME = 'uniq_member0pool_id0address0port'
|
||||
TABLE_NAME = 'members'
|
||||
|
||||
|
||||
def upgrade():
|
||||
if migration.schema_has_table(TABLE_NAME):
|
||||
op.create_unique_constraint(
|
||||
name=CONSTRAINT_NAME,
|
||||
source=TABLE_NAME,
|
||||
local_cols=['pool_id', 'address', 'protocol_port']
|
||||
)
|
||||
@@ -1,31 +0,0 @@
|
||||
# Copyright 2014 Yahoo! Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""icehouse
|
||||
|
||||
Revision ID: icehouse
|
||||
Revises: 5ac1c354a051
|
||||
Create Date: 2013-03-28 00:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'icehouse'
|
||||
down_revision = '5ac1c354a051'
|
||||
|
||||
|
||||
def upgrade():
|
||||
"""A no-op migration for marking the Icehouse release."""
|
||||
pass
|
||||
+7
-3
@@ -13,15 +13,15 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""havana_initial
|
||||
"""juno_initial
|
||||
|
||||
Revision ID: havana
|
||||
Revision ID: juno
|
||||
Revises: None
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'havana'
|
||||
revision = 'juno'
|
||||
down_revision = None
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ from neutron.db.migration.alembic_migrations import agent_init_ops
|
||||
from neutron.db.migration.alembic_migrations import brocade_init_ops
|
||||
from neutron.db.migration.alembic_migrations import cisco_init_ops
|
||||
from neutron.db.migration.alembic_migrations import core_init_ops
|
||||
from neutron.db.migration.alembic_migrations import dvr_init_opts
|
||||
from neutron.db.migration.alembic_migrations import firewall_init_ops
|
||||
from neutron.db.migration.alembic_migrations import l3_init_ops
|
||||
from neutron.db.migration.alembic_migrations import lb_init_ops
|
||||
@@ -37,6 +38,7 @@ from neutron.db.migration.alembic_migrations import metering_init_ops
|
||||
from neutron.db.migration.alembic_migrations import ml2_init_ops
|
||||
from neutron.db.migration.alembic_migrations import mlnx_init_ops
|
||||
from neutron.db.migration.alembic_migrations import nec_init_ops
|
||||
from neutron.db.migration.alembic_migrations import nuage_init_opts
|
||||
from neutron.db.migration.alembic_migrations import other_extensions_init_ops
|
||||
from neutron.db.migration.alembic_migrations import other_plugins_init_ops
|
||||
from neutron.db.migration.alembic_migrations import ovs_init_ops
|
||||
@@ -57,6 +59,7 @@ def upgrade():
|
||||
lb_init_ops.upgrade()
|
||||
ovs_init_ops.upgrade()
|
||||
ml2_init_ops.upgrade()
|
||||
dvr_init_opts.upgrade()
|
||||
firewall_init_ops.upgrade()
|
||||
loadbalancer_init_ops.upgrade()
|
||||
vpn_init_ops.upgrade()
|
||||
@@ -68,3 +71,4 @@ def upgrade():
|
||||
other_plugins_init_ops.upgrade()
|
||||
ryu_init_ops.upgrade()
|
||||
vmware_init_ops.upgrade()
|
||||
nuage_init_opts.upgrade()
|
||||
@@ -1,31 +0,0 @@
|
||||
# Copyright 2014 Yahoo! Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""juno
|
||||
|
||||
Revision ID: juno
|
||||
Revises: 544673ac99ab
|
||||
Create Date: 2014-10-09 00:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'juno'
|
||||
down_revision = '544673ac99ab'
|
||||
|
||||
|
||||
def upgrade():
|
||||
"""A no-op migration for marking the Juno release."""
|
||||
pass
|
||||
@@ -21,7 +21,7 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
net_binding_type = sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
|
||||
name='nvp_network_bindings_binding_type')
|
||||
name='tz_network_bindings_binding_type')
|
||||
l2gw_segmentation_type = sa.Enum('flat', 'vlan',
|
||||
name='networkconnections_segmentation_type')
|
||||
qos_marking = sa.Enum('untrusted', 'trusted', name='qosqueues_qos_marking')
|
||||
@@ -29,15 +29,7 @@ qos_marking = sa.Enum('untrusted', 'trusted', name='qosqueues_qos_marking')
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'quantum_nvp_port_mapping',
|
||||
sa.Column('quantum_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nvp_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['quantum_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('quantum_id'))
|
||||
|
||||
op.create_table(
|
||||
'nvp_network_bindings',
|
||||
'tz_network_bindings',
|
||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('binding_type', net_binding_type, nullable=False),
|
||||
sa.Column('phy_uuid', sa.String(length=36), nullable=True),
|
||||
@@ -48,22 +40,12 @@ def upgrade():
|
||||
'phy_uuid', 'vlan_id'))
|
||||
|
||||
op.create_table(
|
||||
'nvp_multi_provider_networks',
|
||||
'multi_provider_networks',
|
||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('network_id'))
|
||||
|
||||
op.create_table(
|
||||
'nsxrouterextattributess',
|
||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('distributed', sa.Boolean(), nullable=False),
|
||||
sa.Column('service_router', sa.Boolean(), nullable=False,
|
||||
server_default='0'),
|
||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('router_id'))
|
||||
|
||||
op.create_table(
|
||||
'vcns_router_bindings',
|
||||
sa.Column('status', sa.String(length=16), nullable=False),
|
||||
@@ -116,16 +98,6 @@ def upgrade():
|
||||
sa.Column('default', sa.Boolean(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'networkgatewaydevices',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('interface_name', sa.String(length=64), nullable=True),
|
||||
sa.ForeignKeyConstraint(['network_gateway_id'],
|
||||
['networkgateways.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
op.create_table(
|
||||
'networkconnections',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
@@ -148,7 +120,8 @@ def upgrade():
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.Column('default', sa.Boolean(), nullable=True),
|
||||
sa.Column('default', sa.Boolean(), nullable=True,
|
||||
server_default=sa.sql.false()),
|
||||
sa.Column('min', sa.Integer(), nullable=False),
|
||||
sa.Column('max', sa.Integer(), nullable=True),
|
||||
sa.Column('qos_marking', qos_marking, nullable=True),
|
||||
@@ -181,3 +154,90 @@ def upgrade():
|
||||
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('port_id'))
|
||||
|
||||
op.create_table('neutron_nsx_port_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('nsx_port_id', sa.String(length=36),
|
||||
nullable=False),
|
||||
sa.Column('nsx_switch_id', sa.String(length=36),
|
||||
nullable=True),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['ports.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('neutron_id'))
|
||||
|
||||
op.create_table(
|
||||
'lsn',
|
||||
sa.Column('net_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.Column('lsn_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('lsn_id'))
|
||||
|
||||
op.create_table(
|
||||
'lsn_port',
|
||||
sa.Column('lsn_port_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.Column('lsn_id',
|
||||
sa.String(length=36), nullable=False),
|
||||
sa.Column('sub_id',
|
||||
sa.String(length=36), nullable=False, unique=True),
|
||||
sa.Column('mac_addr',
|
||||
sa.String(length=32), nullable=False, unique=True),
|
||||
sa.ForeignKeyConstraint(['lsn_id'], ['lsn.lsn_id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('lsn_port_id'))
|
||||
|
||||
op.create_table(
|
||||
'neutron_nsx_network_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['networks.id'],
|
||||
ondelete='CASCADE'),
|
||||
# There might be multiple switches for a neutron network
|
||||
sa.PrimaryKeyConstraint('neutron_id', 'nsx_id'),
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
'neutron_nsx_router_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=True),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['routers.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('neutron_id'),
|
||||
)
|
||||
# Execute statement to a record in nsx_router_mappings for
|
||||
# each record in routers
|
||||
op.execute("INSERT INTO neutron_nsx_router_mappings SELECT id,id "
|
||||
"from routers")
|
||||
|
||||
op.create_table(
|
||||
'neutron_nsx_security_group_mappings',
|
||||
sa.Column('neutron_id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=False),
|
||||
sa.ForeignKeyConstraint(['neutron_id'], ['securitygroups.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('neutron_id', 'nsx_id'))
|
||||
# Execute statement to add a record in security group mappings for
|
||||
# each record in securitygroups
|
||||
op.execute("INSERT INTO neutron_nsx_security_group_mappings SELECT id,id "
|
||||
"from securitygroups")
|
||||
op.create_table(
|
||||
'networkgatewaydevicereferences',
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('interface_name', sa.String(length=64), nullable=True),
|
||||
sa.ForeignKeyConstraint(['network_gateway_id'], ['networkgateways.id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id', 'network_gateway_id', 'interface_name'))
|
||||
|
||||
op.create_table(
|
||||
'networkgatewaydevices',
|
||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('id', sa.String(length=36), nullable=False),
|
||||
sa.Column('nsx_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.Column('connector_type', sa.String(length=10), nullable=True),
|
||||
sa.Column('connector_ip', sa.String(length=64), nullable=True),
|
||||
sa.Column('status', sa.String(length=16), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,3 @@ class TestDBCreation(base.BaseTestCase):
|
||||
def test_head_creation(self):
|
||||
from neutron.db.migration.models import head
|
||||
self._test_creation(head)
|
||||
|
||||
def test_frozen_creation(self):
|
||||
from neutron.db.migration.models import frozen
|
||||
self._test_creation(frozen)
|
||||
|
||||
Reference in New Issue
Block a user