Merge "Remove logic for conditional migrations"
This commit is contained in:
commit
696ff69947
|
@ -20,10 +20,6 @@ from alembic import context
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
OVS_PLUGIN = ('neutron.plugins.openvswitch.ovs_neutron_plugin'
|
|
||||||
'.OVSNeutronPluginV2')
|
|
||||||
CISCO_PLUGIN = 'neutron.plugins.cisco.network_plugin.PluginV2'
|
|
||||||
|
|
||||||
|
|
||||||
def skip_if_offline(func):
|
def skip_if_offline(func):
|
||||||
"""Decorator for skipping migrations in offline mode."""
|
"""Decorator for skipping migrations in offline mode."""
|
||||||
|
@ -94,16 +90,6 @@ def rename_table_if_exists(old_table_name, new_table_name):
|
||||||
op.rename_table(old_table_name, new_table_name)
|
op.rename_table(old_table_name, new_table_name)
|
||||||
|
|
||||||
|
|
||||||
def should_run(active_plugins, migrate_plugins):
|
|
||||||
if '*' in migrate_plugins:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
if (CISCO_PLUGIN not in migrate_plugins and
|
|
||||||
OVS_PLUGIN in migrate_plugins):
|
|
||||||
migrate_plugins.append(CISCO_PLUGIN)
|
|
||||||
return set(active_plugins) & set(migrate_plugins)
|
|
||||||
|
|
||||||
|
|
||||||
def alter_enum(table, column, enum_type, nullable):
|
def alter_enum(table, column, enum_type, nullable):
|
||||||
bind = op.get_bind()
|
bind = op.get_bind()
|
||||||
engine = bind.engine
|
engine = bind.engine
|
||||||
|
|
|
@ -37,10 +37,6 @@ neutron_config = config.neutron_config
|
||||||
# This line sets up loggers basically.
|
# This line sets up loggers basically.
|
||||||
logging_config.fileConfig(config.config_file_name)
|
logging_config.fileConfig(config.config_file_name)
|
||||||
|
|
||||||
plugin_class_path = neutron_config.core_plugin
|
|
||||||
active_plugins = [plugin_class_path]
|
|
||||||
active_plugins += neutron_config.service_plugins
|
|
||||||
|
|
||||||
# set the target for 'autogenerate' support
|
# set the target for 'autogenerate' support
|
||||||
target_metadata = model_base.BASEV2.metadata
|
target_metadata = model_base.BASEV2.metadata
|
||||||
|
|
||||||
|
@ -76,8 +72,7 @@ def run_migrations_offline():
|
||||||
context.configure(**kwargs)
|
context.configure(**kwargs)
|
||||||
|
|
||||||
with context.begin_transaction():
|
with context.begin_transaction():
|
||||||
context.run_migrations(active_plugins=active_plugins,
|
context.run_migrations()
|
||||||
options=build_options())
|
|
||||||
|
|
||||||
|
|
||||||
@event.listens_for(sa.Table, 'after_parent_attach')
|
@event.listens_for(sa.Table, 'after_parent_attach')
|
||||||
|
@ -104,16 +99,11 @@ def run_migrations_online():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with context.begin_transaction():
|
with context.begin_transaction():
|
||||||
context.run_migrations(active_plugins=active_plugins,
|
context.run_migrations()
|
||||||
options=build_options())
|
|
||||||
finally:
|
finally:
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
|
||||||
def build_options():
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
if context.is_offline_mode():
|
if context.is_offline_mode():
|
||||||
run_migrations_offline()
|
run_migrations_offline()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -19,6 +19,17 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
def create_routerroutes():
|
||||||
|
op.create_table(
|
||||||
|
'routerroutes',
|
||||||
|
sa.Column('destination', sa.String(length=64), nullable=False),
|
||||||
|
sa.Column('nexthop', sa.String(length=64), nullable=False),
|
||||||
|
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
||||||
|
ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('destination', 'nexthop', 'router_id'))
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'externalnetworks',
|
'externalnetworks',
|
||||||
|
@ -55,14 +66,7 @@ def upgrade():
|
||||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ),
|
sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id'))
|
sa.PrimaryKeyConstraint('id'))
|
||||||
|
|
||||||
op.create_table(
|
create_routerroutes()
|
||||||
'routerroutes',
|
|
||||||
sa.Column('destination', sa.String(length=64), nullable=False),
|
|
||||||
sa.Column('nexthop', sa.String(length=64), nullable=False),
|
|
||||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
|
|
||||||
ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('destination', 'nexthop', 'router_id'))
|
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'routerl3agentbindings',
|
'routerl3agentbindings',
|
||||||
|
|
|
@ -24,7 +24,7 @@ direction = sa.Enum('ingress', 'egress',
|
||||||
name='meteringlabels_direction')
|
name='meteringlabels_direction')
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def create_meteringlabels():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'meteringlabels',
|
'meteringlabels',
|
||||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||||
|
@ -33,6 +33,10 @@ def upgrade():
|
||||||
sa.Column('description', sa.String(length=1024), nullable=True),
|
sa.Column('description', sa.String(length=1024), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id'))
|
sa.PrimaryKeyConstraint('id'))
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
create_meteringlabels()
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'meteringlabelrules',
|
'meteringlabelrules',
|
||||||
sa.Column('id', sa.String(length=36), nullable=False),
|
sa.Column('id', sa.String(length=36), nullable=False),
|
||||||
|
|
|
@ -20,6 +20,18 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
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():
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'ml2_vlan_allocations',
|
'ml2_vlan_allocations',
|
||||||
|
@ -96,15 +108,7 @@ def upgrade():
|
||||||
sa.PrimaryKeyConstraint('binding_id'),
|
sa.PrimaryKeyConstraint('binding_id'),
|
||||||
)
|
)
|
||||||
|
|
||||||
op.create_table(
|
create_cisco_ml2_credentials()
|
||||||
'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'),
|
|
||||||
)
|
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'arista_provisioned_nets',
|
'arista_provisioned_nets',
|
||||||
|
|
|
@ -30,9 +30,9 @@ import sqlalchemy as sa
|
||||||
${imports if imports else ""}
|
${imports if imports else ""}
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
${upgrades if upgrades else "pass"}
|
${upgrades if upgrades else "pass"}
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
${downgrades if downgrades else "pass"}
|
${downgrades if downgrades else "pass"}
|
||||||
|
|
|
@ -30,9 +30,16 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
from neutron.db.migration.alembic_migrations import l3_init_ops
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
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(
|
op.create_table(
|
||||||
'routerroutes_mapping',
|
'routerroutes_mapping',
|
||||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||||
|
@ -42,25 +49,10 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
# This table might already exist as it might have been created
|
# This table might already exist as it might have been created
|
||||||
# if another plugin was configured before the nuage one
|
# if another plugin was configured before the nuage one
|
||||||
if op.get_bind().engine.dialect.name == 'postgresql':
|
if not migration.schema_has_table('routerroutes'):
|
||||||
migration.create_table_if_not_exist_psql(
|
l3_init_ops.create_routerroutes()
|
||||||
'routerroutes',
|
|
||||||
("(destination VARCHAR(64) NOT NULL,"
|
|
||||||
"nexthop VARCHAR(64) NOT NULL,"
|
|
||||||
"router_id VARCHAR(36) NOT NULL,"
|
|
||||||
"PRIMARY KEY (destination, nexthop, router_id),"
|
|
||||||
"FOREIGN KEY (router_id) REFERENCES routers (id) "
|
|
||||||
"ON DELETE CASCADE ON UPDATE CASCADE)"))
|
|
||||||
else:
|
|
||||||
op.execute("CREATE TABLE IF NOT EXISTS routerroutes( "
|
|
||||||
"destination VARCHAR(64) NOT NULL,"
|
|
||||||
"nexthop VARCHAR(64) NOT NULL,"
|
|
||||||
"router_id VARCHAR(36) NOT NULL,"
|
|
||||||
"PRIMARY KEY (destination, nexthop, router_id),"
|
|
||||||
"FOREIGN KEY (router_id) REFERENCES routers (id) "
|
|
||||||
"ON DELETE CASCADE ON UPDATE CASCADE)")
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
# The routerroutes table should not be dropped
|
# The routerroutes table should not be dropped
|
||||||
op.execute('DROP TABLE IF EXISTS routerroutes_mapping')
|
op.drop_table('routerroutes_mapping')
|
||||||
|
|
|
@ -25,12 +25,6 @@ Create Date: 2014-03-02 05:26:47.073318
|
||||||
revision = '117643811bca'
|
revision = '117643811bca'
|
||||||
down_revision = '81c553f3776c'
|
down_revision = '81c553f3776c'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nec.nec_plugin.NECPluginV2'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy.ext import compiler as sa_compiler
|
from sqlalchemy.ext import compiler as sa_compiler
|
||||||
|
@ -71,15 +65,17 @@ def visit_insert_from_select(element, compiler, **kw):
|
||||||
return sql
|
return sql
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
# Table definitions below are only used for sqlalchemy to generate
|
# Table definitions below are only used for sqlalchemy to generate
|
||||||
# SQL statements, so in networks/ports tables only required field
|
# SQL statements, so in networks/ports tables only required field
|
||||||
# are declared. Note that 'quantum_id' in OFC ID mapping tables
|
# are declared. Note that 'quantum_id' in OFC ID mapping tables
|
||||||
# will be renamed in a later patch (bug 1287432).
|
# 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.table(
|
||||||
'ofctenants',
|
'ofctenants',
|
||||||
sa_expr.column('id'),
|
sa_expr.column('id'),
|
||||||
|
@ -178,5 +174,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
op.drop_table('ofcfilters')
|
op.drop_table('ofcfilters')
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -26,23 +26,11 @@ Create Date: 2013-10-11 14:33:37.303215
|
||||||
revision = '1421183d533f'
|
revision = '1421183d533f'
|
||||||
down_revision = '50e86cb2637a'
|
down_revision = '50e86cb2637a'
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'lsn',
|
'lsn',
|
||||||
sa.Column('net_id',
|
sa.Column('net_id',
|
||||||
|
@ -66,5 +54,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
sa.PrimaryKeyConstraint('lsn_port_id'))
|
sa.PrimaryKeyConstraint('lsn_port_id'))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,26 +25,18 @@ Create Date: 2014-02-13 23:48:25.147279
|
||||||
revision = '157a5d299379'
|
revision = '157a5d299379'
|
||||||
down_revision = '50d5ba354c23'
|
down_revision = '50d5ba354c23'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.ml2.plugin.Ml2Plugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
if migration.schema_has_table('ml2_port_bindings'):
|
||||||
return
|
|
||||||
|
|
||||||
op.add_column('ml2_port_bindings',
|
op.add_column('ml2_port_bindings',
|
||||||
sa.Column('profile', sa.String(length=4095),
|
sa.Column('profile', sa.String(length=4095),
|
||||||
nullable=False, server_default=''))
|
nullable=False, server_default=''))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,23 +25,17 @@ Create Date: 2014-02-26 02:46:26.151741
|
||||||
revision = '19180cf98af6'
|
revision = '19180cf98af6'
|
||||||
down_revision = '117643811bca'
|
down_revision = '117643811bca'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
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
|
return
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
|
@ -78,5 +72,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
"gw_dev_ref.network_gateway_id=net_gw.id")
|
"gw_dev_ref.network_gateway_id=net_gw.id")
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -23,24 +23,19 @@ Create Date: 2013-12-27 13:02:42.894648
|
||||||
revision = '1b2580001654'
|
revision = '1b2580001654'
|
||||||
down_revision = 'abc88c33f74f'
|
down_revision = 'abc88c33f74f'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
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
|
return
|
||||||
|
|
||||||
# Create table for security group mappings
|
# Create table for security group mappings
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'neutron_nsx_security_group_mappings',
|
'neutron_nsx_security_group_mappings',
|
||||||
|
@ -55,5 +50,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
"from securitygroups")
|
"from securitygroups")
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -30,7 +30,7 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'cisco_ml2_apic_epgs',
|
'cisco_ml2_apic_epgs',
|
||||||
sa.Column('network_id', sa.String(length=255), nullable=False),
|
sa.Column('network_id', sa.String(length=255), nullable=False),
|
||||||
|
|
|
@ -28,9 +28,9 @@ down_revision = '5446f2a45467'
|
||||||
from neutron.db.migration.alembic_migrations import heal_script
|
from neutron.db.migration.alembic_migrations import heal_script
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
heal_script.heal()
|
heal_script.heal()
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,20 +25,13 @@ Create Date: 2014-03-17 11:00:35.370618
|
||||||
revision = '1e5dd1d09b22'
|
revision = '1e5dd1d09b22'
|
||||||
down_revision = '54f7549a0e5f'
|
down_revision = '54f7549a0e5f'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
# This migration will be executed only if the neutron DB schema
|
|
||||||
# contains the tables for load balancing service plugin.
|
|
||||||
# This migration will be skipped when executed in offline mode.
|
|
||||||
|
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'poolstatisticss', 'bytes_in',
|
'poolstatisticss', 'bytes_in',
|
||||||
nullable=False,
|
nullable=False,
|
||||||
|
@ -58,7 +51,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'poolstatisticss', 'bytes_in',
|
'poolstatisticss', 'bytes_in',
|
||||||
nullable=True,
|
nullable=True,
|
||||||
|
|
|
@ -25,22 +25,6 @@ Create Date: 2013-11-27 18:35:28.148680
|
||||||
revision = '1fcfc149aca4'
|
revision = '1fcfc149aca4'
|
||||||
down_revision = 'e197124d4b9'
|
down_revision = 'e197124d4b9'
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
|
|
||||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
|
||||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
|
||||||
'neutron.plugins.ml2.plugin.Ml2Plugin',
|
|
||||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
|
||||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin',
|
|
||||||
'neutron.plugins.ibm.sdnve_neutron_plugin.SdnvePluginV2',
|
|
||||||
'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2',
|
|
||||||
'neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin',
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
@ -50,8 +34,11 @@ TABLE_NAME = 'agents'
|
||||||
UC_NAME = 'uniq_agents0agent_type0host'
|
UC_NAME = 'uniq_agents0agent_type0host'
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
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
|
return
|
||||||
|
|
||||||
op.create_unique_constraint(
|
op.create_unique_constraint(
|
||||||
|
@ -61,5 +48,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
|
@ -25,20 +25,12 @@ Create Date: 2014-06-23 19:12:43.392912
|
||||||
revision = '2026156eab2f'
|
revision = '2026156eab2f'
|
||||||
down_revision = '3927f7f7c456'
|
down_revision = '3927f7f7c456'
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'*'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'dvr_host_macs',
|
'dvr_host_macs',
|
||||||
sa.Column('host', sa.String(length=255), nullable=False),
|
sa.Column('host', sa.String(length=255), nullable=False),
|
||||||
|
@ -70,9 +62,6 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
op.drop_table('ml2_dvr_port_bindings')
|
op.drop_table('ml2_dvr_port_bindings')
|
||||||
op.drop_table('dvr_host_macs')
|
op.drop_table('dvr_host_macs')
|
||||||
|
|
|
@ -29,13 +29,13 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
|
|
||||||
op.add_column('ml2_network_segments',
|
op.add_column('ml2_network_segments',
|
||||||
sa.Column('is_dynamic', sa.Boolean(), nullable=False,
|
sa.Column('is_dynamic', sa.Boolean(), nullable=False,
|
||||||
server_default=sa.sql.false()))
|
server_default=sa.sql.false()))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
|
|
||||||
op.drop_column('ml2_network_segments', 'is_dynamic')
|
op.drop_column('ml2_network_segments', 'is_dynamic')
|
||||||
|
|
|
@ -26,23 +26,11 @@ Create Date: 2013-10-23 16:36:44.188904
|
||||||
revision = '2447ad0e9585'
|
revision = '2447ad0e9585'
|
||||||
down_revision = '33dd0a9fa487'
|
down_revision = '33dd0a9fa487'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'*'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
from neutron.db import migration
|
def upgrade():
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
# Workaround for Alemic bug #89
|
# Workaround for Alemic bug #89
|
||||||
# https://bitbucket.org/zzzeek/alembic/issue/89
|
# https://bitbucket.org/zzzeek/alembic/issue/89
|
||||||
context = op.get_context()
|
context = op.get_context()
|
||||||
|
@ -69,5 +57,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -23,22 +23,16 @@
|
||||||
revision = '24c7ea5160d7'
|
revision = '24c7ea5160d7'
|
||||||
down_revision = '492a106273f8'
|
down_revision = '492a106273f8'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.services.vpn.plugin.VPNDriverPlugin',
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
if not migration.schema_has_table('ipsec_site_connections'):
|
||||||
|
# The vpnaas service plugin was not configured.
|
||||||
return
|
return
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'cisco_csr_identifier_map',
|
'cisco_csr_identifier_map',
|
||||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||||
|
@ -53,5 +47,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,27 +25,19 @@ Create Date: 2014-02-09 12:19:21.362967
|
||||||
revision = '27cc183af192'
|
revision = '27cc183af192'
|
||||||
down_revision = '4ca36cfc898c'
|
down_revision = '4ca36cfc898c'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.ml2.plugin.Ml2Plugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
if migration.schema_has_table('ml2_port_bindings'):
|
||||||
return
|
|
||||||
|
|
||||||
op.add_column('ml2_port_bindings',
|
op.add_column('ml2_port_bindings',
|
||||||
sa.Column('vnic_type', sa.String(length=64),
|
sa.Column('vnic_type', sa.String(length=64),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
server_default='normal'))
|
server_default='normal'))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -37,9 +37,12 @@ from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
# These tables will be created even if the nuage plugin is not enabled.
|
# 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.
|
# 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(
|
op.create_table(
|
||||||
'nuage_floatingip_pool_mapping',
|
'nuage_floatingip_pool_mapping',
|
||||||
sa.Column('fip_pool_id', sa.String(length=36), nullable=False),
|
sa.Column('fip_pool_id', sa.String(length=36), nullable=False),
|
||||||
|
@ -51,6 +54,9 @@ def upgrade(active_plugins=None, options=None):
|
||||||
ondelete='CASCADE'),
|
ondelete='CASCADE'),
|
||||||
sa.PrimaryKeyConstraint('fip_pool_id'),
|
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(
|
op.create_table(
|
||||||
'nuage_floatingip_mapping',
|
'nuage_floatingip_mapping',
|
||||||
sa.Column('fip_id', sa.String(length=36), nullable=False),
|
sa.Column('fip_id', sa.String(length=36), nullable=False),
|
||||||
|
@ -75,7 +81,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
migration.drop_table_if_exists('nuage_floatingip_mapping')
|
migration.drop_table_if_exists('nuage_floatingip_mapping')
|
||||||
migration.drop_table_if_exists('nuage_floatingip_pool_mapping')
|
migration.drop_table_if_exists('nuage_floatingip_pool_mapping')
|
||||||
migration.rename_table_if_exists('nuage_net_partitions', 'net_partitions')
|
migration.rename_table_if_exists('nuage_net_partitions', 'net_partitions')
|
||||||
|
|
|
@ -25,43 +25,19 @@ Create Date: 2014-01-14 11:58:13.754747
|
||||||
revision = '2eeaf963a447'
|
revision = '2eeaf963a447'
|
||||||
down_revision = 'e766b19a3bb'
|
down_revision = 'e766b19a3bb'
|
||||||
|
|
||||||
# This migration is applied to all L3 capable plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2',
|
|
||||||
'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
|
|
||||||
'neutron.plugins.cisco.network_plugin.PluginV2',
|
|
||||||
'neutron.plugins.cisco.n1kv.n1kv_neutron_plugin.N1kvNeutronPluginV2',
|
|
||||||
'neutron.plugins.embrane.plugins.embrane_ovs_plugin.EmbraneOvsPlugin',
|
|
||||||
'neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin',
|
|
||||||
'neutron.plugins.ibm.sdnve_neutron_plugin.SdnvePluginV2',
|
|
||||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
|
||||||
'neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2',
|
|
||||||
'neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin',
|
|
||||||
'neutron.plugins.midonet.plugin.MidonetPluginV2',
|
|
||||||
'neutron.plugins.ml2.plugin.Ml2Plugin',
|
|
||||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.nuage.plugin.NuagePlugin',
|
|
||||||
'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2',
|
|
||||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
|
||||||
'neutron.plugins.plumgrid.plumgrid_plugin.plumgrid_plugin.'
|
|
||||||
'NeutronPluginPLUMgridV2',
|
|
||||||
'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
if not migration.schema_has_table('floatingips'):
|
||||||
|
# In the database we are migrating from, the configured plugin
|
||||||
|
# did not create the floatingips table.
|
||||||
return
|
return
|
||||||
|
|
||||||
op.add_column('floatingips',
|
op.add_column('floatingips',
|
||||||
sa.Column('last_known_router_id',
|
sa.Column('last_known_router_id',
|
||||||
sa.String(length=36),
|
sa.String(length=36),
|
||||||
|
@ -72,5 +48,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
nullable=True))
|
nullable=True))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ fk_names = {'postgresql':
|
||||||
'routerl3agentbindings_ibfk_1'}}
|
'routerl3agentbindings_ibfk_1'}}
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
# In order to sanitize the data during migration,
|
# In order to sanitize the data during migration,
|
||||||
# the current records in the table need to be verified
|
# the current records in the table need to be verified
|
||||||
# and all the duplicate records which violate the PK
|
# and all the duplicate records which violate the PK
|
||||||
|
@ -72,7 +72,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
|
|
||||||
context = op.get_context()
|
context = op.get_context()
|
||||||
dialect = context.bind.dialect.name
|
dialect = context.bind.dialect.name
|
||||||
|
|
|
@ -34,13 +34,11 @@ TABLES = ['router_extra_attributes', 'dvr_host_macs', 'ml2_dvr_port_bindings',
|
||||||
'csnat_l3_agent_bindings']
|
'csnat_l3_agent_bindings']
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
|
|
||||||
if op.get_bind().dialect.name == 'mysql':
|
if op.get_bind().dialect.name == 'mysql':
|
||||||
for table in TABLES:
|
for table in TABLES:
|
||||||
op.execute("ALTER TABLE %s ENGINE=InnoDB" % table)
|
op.execute("ALTER TABLE %s ENGINE=InnoDB" % table)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -28,7 +28,7 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
|
|
||||||
op.drop_table('cisco_ml2_apic_port_profiles')
|
op.drop_table('cisco_ml2_apic_port_profiles')
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
sa.PrimaryKeyConstraint('neutron_id', 'neutron_type'))
|
sa.PrimaryKeyConstraint('neutron_id', 'neutron_type'))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
|
|
||||||
op.drop_table('cisco_ml2_apic_names')
|
op.drop_table('cisco_ml2_apic_names')
|
||||||
op.drop_table('cisco_ml2_apic_host_links')
|
op.drop_table('cisco_ml2_apic_host_links')
|
||||||
|
|
|
@ -29,26 +29,16 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
from neutron.db.migration.alembic_migrations import metering_init_ops
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if op.get_bind().engine.dialect.name == 'postgresql':
|
if migration.schema_has_table('meteringlabels'):
|
||||||
migration.create_table_if_not_exist_psql(
|
|
||||||
'meteringlabels',
|
|
||||||
"(tenant_id VARCHAR(255) NULL, "
|
|
||||||
"id VARCHAR(36) PRIMARY KEY NOT NULL, "
|
|
||||||
"name VARCHAR(255) NULL, "
|
|
||||||
"description VARCHAR(255) NULL)")
|
|
||||||
else:
|
|
||||||
op.execute("CREATE TABLE IF NOT EXISTS meteringlabels( "
|
|
||||||
"tenant_id VARCHAR(255) NULL, "
|
|
||||||
"id VARCHAR(36) PRIMARY KEY NOT NULL, "
|
|
||||||
"name VARCHAR(255) NULL, "
|
|
||||||
"description VARCHAR(255) NULL)")
|
|
||||||
|
|
||||||
op.alter_column('meteringlabels', 'description', type_=sa.String(1024),
|
op.alter_column('meteringlabels', 'description', type_=sa.String(1024),
|
||||||
existing_nullable=True)
|
existing_nullable=True)
|
||||||
|
else:
|
||||||
|
metering_init_ops.create_meteringlabels()
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,22 +25,16 @@ Create Date: 2014-02-25 00:15:35.567111
|
||||||
revision = '33dd0a9fa487'
|
revision = '33dd0a9fa487'
|
||||||
down_revision = '19180cf98af6'
|
down_revision = '19180cf98af6'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
if not migration.schema_has_table('pools'):
|
||||||
|
# The lbaas service plugin was not configured.
|
||||||
return
|
return
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
u'embrane_pool_port',
|
u'embrane_pool_port',
|
||||||
sa.Column(u'pool_id', sa.String(length=36), nullable=False),
|
sa.Column(u'pool_id', sa.String(length=36), nullable=False),
|
||||||
|
@ -52,5 +46,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
sa.PrimaryKeyConstraint(u'pool_id'))
|
sa.PrimaryKeyConstraint(u'pool_id'))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,22 +25,11 @@ Create Date: 2014-07-09 17:25:29.242948
|
||||||
revision = '37f322991f59'
|
revision = '37f322991f59'
|
||||||
down_revision = '2026156eab2f'
|
down_revision = '2026156eab2f'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'*'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
op.drop_table('nuage_floatingip_mapping')
|
op.drop_table('nuage_floatingip_mapping')
|
||||||
op.drop_table('nuage_floatingip_pool_mapping')
|
op.drop_table('nuage_floatingip_pool_mapping')
|
||||||
op.drop_table('nuage_routerroutes_mapping')
|
op.drop_table('nuage_routerroutes_mapping')
|
||||||
|
@ -48,10 +37,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
op.drop_table('nuage_router_zone_mapping')
|
op.drop_table('nuage_router_zone_mapping')
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'nuage_router_zone_mapping',
|
'nuage_router_zone_mapping',
|
||||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||||
|
|
|
@ -24,21 +24,11 @@ Create Date: 2014-04-02 23:26:19.303633
|
||||||
revision = '3927f7f7c456'
|
revision = '3927f7f7c456'
|
||||||
down_revision = 'db_healing'
|
down_revision = 'db_healing'
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'*'
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'router_extra_attributes',
|
'router_extra_attributes',
|
||||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||||
|
@ -52,8 +42,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
"False as distributed from routers")
|
"False as distributed from routers")
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
op.drop_table('router_extra_attributes')
|
op.drop_table('router_extra_attributes')
|
||||||
|
|
|
@ -31,13 +31,16 @@ down_revision = '327ee5fde2c7'
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
|
||||||
|
from neutron.db import migration
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
|
def upgrade():
|
||||||
for table in ('servicedefinitions', 'servicetypes'):
|
for table in ('servicedefinitions', 'servicetypes'):
|
||||||
op.execute("DROP TABLE IF EXISTS %s" % table)
|
if migration.schema_has_table(table):
|
||||||
|
op.drop_table(table)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
"""Don't create the tables
|
"""Don't create the tables
|
||||||
|
|
||||||
These tables would be created during downgrade at correct place in
|
These tables would be created during downgrade at correct place in
|
||||||
|
|
|
@ -25,22 +25,16 @@ Create Date: 2014-02-11 18:18:34.319031
|
||||||
revision = '3d2585038b95'
|
revision = '3d2585038b95'
|
||||||
down_revision = '157a5d299379'
|
down_revision = '157a5d299379'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
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
|
return
|
||||||
|
|
||||||
op.rename_table('nvp_network_bindings', 'tz_network_bindings')
|
op.rename_table('nvp_network_bindings', 'tz_network_bindings')
|
||||||
|
@ -52,5 +46,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
"RENAME TO tz_network_bindings_binding_type;")
|
"RENAME TO tz_network_bindings_binding_type;")
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -23,25 +23,11 @@ Create Date: 2014-01-07 15:37:41.323020
|
||||||
revision = '3d3cb89d84ee'
|
revision = '3d3cb89d84ee'
|
||||||
down_revision = '1421183d533f'
|
down_revision = '1421183d533f'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
# Create table for network mappings
|
# Create table for network mappings
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'neutron_nsx_network_mappings',
|
'neutron_nsx_network_mappings',
|
||||||
|
@ -54,5 +40,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
|
@ -25,23 +25,11 @@ Create Date: 2014-03-03 15:35:46.974523
|
||||||
revision = '492a106273f8'
|
revision = '492a106273f8'
|
||||||
down_revision = '2eeaf963a447'
|
down_revision = '2eeaf963a447'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.ml2.plugin.Ml2Plugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
from neutron.db import migration
|
def upgrade():
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'ml2_brocadenetworks',
|
'ml2_brocadenetworks',
|
||||||
sa.Column('id', sa.String(length=36), nullable=False),
|
sa.Column('id', sa.String(length=36), nullable=False),
|
||||||
|
@ -63,5 +51,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
sa.ForeignKeyConstraint(['network_id'], ['ml2_brocadenetworks.id']))
|
sa.ForeignKeyConstraint(['network_id'], ['ml2_brocadenetworks.id']))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -23,23 +23,17 @@ Create Date: 2014-01-08 10:41:43.373031
|
||||||
revision = '4ca36cfc898c'
|
revision = '4ca36cfc898c'
|
||||||
down_revision = '3d3cb89d84ee'
|
down_revision = '3d3cb89d84ee'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
if not migration.schema_has_table('routers'):
|
||||||
|
# In the database we are migrating from, the configured plugin
|
||||||
|
# did not create the routers table.
|
||||||
return
|
return
|
||||||
|
|
||||||
# Create table for router/lrouter mappings
|
# Create table for router/lrouter mappings
|
||||||
|
@ -57,5 +51,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
"from routers")
|
"from routers")
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -33,11 +33,11 @@ TABLE_NAME = 'ml2_vxlan_endpoints'
|
||||||
PK_NAME = 'ml2_vxlan_endpoints_pkey'
|
PK_NAME = 'ml2_vxlan_endpoints_pkey'
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
op.drop_constraint(PK_NAME, TABLE_NAME, type_='primary')
|
op.drop_constraint(PK_NAME, TABLE_NAME, type_='primary')
|
||||||
op.create_primary_key(PK_NAME, TABLE_NAME, cols=['ip_address'])
|
op.create_primary_key(PK_NAME, TABLE_NAME, cols=['ip_address'])
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
op.drop_constraint(PK_NAME, TABLE_NAME, type_='primary')
|
op.drop_constraint(PK_NAME, TABLE_NAME, type_='primary')
|
||||||
op.create_primary_key(PK_NAME, TABLE_NAME, cols=['ip_address', 'udp_port'])
|
op.create_primary_key(PK_NAME, TABLE_NAME, cols=['ip_address', 'udp_port'])
|
||||||
|
|
|
@ -29,27 +29,17 @@ down_revision = '33c3db036fe4'
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
from neutron.db.migration.alembic_migrations import ml2_init_ops
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
TABLE = 'cisco_ml2_credentials'
|
||||||
op.execute('DROP TABLE IF EXISTS cisco_ml2_credentials')
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if op.get_bind().engine.dialect.name == 'postgresql':
|
if migration.schema_has_table(TABLE):
|
||||||
migration.create_table_if_not_exist_psql(
|
op.drop_table(TABLE)
|
||||||
'cisco_ml2_credentials',
|
|
||||||
("(credential_id VARCHAR(255) NULL,"
|
|
||||||
"tenant_id VARCHAR(255) NOT NULL,"
|
def downgrade():
|
||||||
"credential_name VARCHAR(255) NOT NULL,"
|
if not migration.schema_has_table(TABLE):
|
||||||
"user_name VARCHAR(255) NULL,"
|
ml2_init_ops.create_cisco_ml2_credentials()
|
||||||
"password VARCHAR(255) NULL,"
|
|
||||||
"PRIMARY KEY (tenant_id, credential_name))"))
|
|
||||||
else:
|
|
||||||
op.execute('CREATE TABLE IF NOT EXISTS cisco_ml2_credentials( '
|
|
||||||
'credential_id VARCHAR(255) NULL,'
|
|
||||||
'tenant_id VARCHAR(255) NOT NULL,'
|
|
||||||
'credential_name VARCHAR(255) NOT NULL,'
|
|
||||||
'user_name VARCHAR(255) NULL,'
|
|
||||||
'password VARCHAR(255) NULL,'
|
|
||||||
'PRIMARY KEY (tenant_id, credential_name))')
|
|
||||||
|
|
|
@ -25,20 +25,17 @@ Create Date: 2014-02-11 23:21:59.577972
|
||||||
revision = '50d5ba354c23'
|
revision = '50d5ba354c23'
|
||||||
down_revision = '27cc183af192'
|
down_revision = '27cc183af192'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.ml2.plugin.Ml2Plugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
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
|
return
|
||||||
|
|
||||||
op.add_column('ml2_port_bindings',
|
op.add_column('ml2_port_bindings',
|
||||||
|
@ -67,5 +64,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
|
op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,25 +25,13 @@ Create Date: 2013-10-26 14:37:30.012149
|
||||||
revision = '50e86cb2637a'
|
revision = '50e86cb2637a'
|
||||||
down_revision = '1fcfc149aca4'
|
down_revision = '1fcfc149aca4'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
|
||||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
op.create_table('neutron_nsx_port_mappings',
|
op.create_table('neutron_nsx_port_mappings',
|
||||||
sa.Column('neutron_id', sa.String(length=36),
|
sa.Column('neutron_id', sa.String(length=36),
|
||||||
nullable=False),
|
nullable=False),
|
||||||
|
@ -55,11 +43,13 @@ def upgrade(active_plugins=None, options=None):
|
||||||
ondelete='CASCADE'),
|
ondelete='CASCADE'),
|
||||||
sa.PrimaryKeyConstraint('neutron_id'))
|
sa.PrimaryKeyConstraint('neutron_id'))
|
||||||
|
|
||||||
op.execute("INSERT INTO neutron_nsx_port_mappings SELECT quantum_id as "
|
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"
|
"neutron_id, nvp_id as nsx_port_id, null as nsx_switch_id from"
|
||||||
" quantum_nvp_port_mapping")
|
" quantum_nvp_port_mapping")
|
||||||
op.drop_table('quantum_nvp_port_mapping')
|
op.drop_table('quantum_nvp_port_mapping')
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -25,20 +25,17 @@ Create Date: 2014-03-04 05:43:33.660601
|
||||||
revision = '538732fa21e1'
|
revision = '538732fa21e1'
|
||||||
down_revision = '2447ad0e9585'
|
down_revision = '2447ad0e9585'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nec.nec_plugin.NECPluginV2'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
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
|
return
|
||||||
|
|
||||||
for table in ['ofctenantmappings', 'ofcnetworkmappings',
|
for table in ['ofctenantmappings', 'ofcnetworkmappings',
|
||||||
|
@ -51,5 +48,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
existing_nullable=False)
|
existing_nullable=False)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -29,7 +29,6 @@ down_revision = '2db5203cb7a9'
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
import sqlalchemy.sql
|
import sqlalchemy.sql
|
||||||
|
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
from neutron.plugins.cisco.common import cisco_constants
|
from neutron.plugins.cisco.common import cisco_constants
|
||||||
|
|
||||||
|
@ -50,16 +49,16 @@ from neutron.plugins.cisco.common import cisco_constants
|
||||||
# This migration will be skipped when executed offline mode.
|
# This migration will be skipped when executed offline mode.
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
run(active_plugins, True)
|
run(True)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
run(active_plugins, None)
|
run()
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def run(active_plugins, default):
|
def run(default=None):
|
||||||
set_default_ml2(default)
|
set_default_ml2(default)
|
||||||
set_default_mlnx(default)
|
set_default_mlnx(default)
|
||||||
set_default_brocade(default)
|
set_default_brocade(default)
|
||||||
|
|
|
@ -36,7 +36,7 @@ from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'ipsec_site_connections', 'peer_address',
|
'ipsec_site_connections', 'peer_address',
|
||||||
existing_type=sa.String(255),
|
existing_type=sa.String(255),
|
||||||
|
@ -44,7 +44,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'ipsec_site_connections', 'peer_address',
|
'ipsec_site_connections', 'peer_address',
|
||||||
nullable=True,
|
nullable=True,
|
||||||
|
|
|
@ -25,20 +25,11 @@ Create Date: 2014-07-7 11:00:43.392912
|
||||||
revision = '5589aa32bf80'
|
revision = '5589aa32bf80'
|
||||||
down_revision = '31d7f831a591'
|
down_revision = '31d7f831a591'
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'*'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'csnat_l3_agent_bindings',
|
'csnat_l3_agent_bindings',
|
||||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||||
|
@ -55,8 +46,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
op.drop_table('csnat_l3_agent_bindings')
|
op.drop_table('csnat_l3_agent_bindings')
|
||||||
|
|
|
@ -29,7 +29,7 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
op.create_table('cisco_hosting_devices',
|
op.create_table('cisco_hosting_devices',
|
||||||
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
sa.Column('tenant_id', sa.String(length=255), nullable=True),
|
||||||
sa.Column('id', sa.String(length=36), nullable=False),
|
sa.Column('id', sa.String(length=36), nullable=False),
|
||||||
|
@ -73,7 +73,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
op.drop_table('cisco_router_mappings')
|
op.drop_table('cisco_router_mappings')
|
||||||
op.drop_table('cisco_port_mappings')
|
op.drop_table('cisco_port_mappings')
|
||||||
op.drop_table('cisco_hosting_devices')
|
op.drop_table('cisco_hosting_devices')
|
||||||
|
|
|
@ -25,20 +25,17 @@ Create Date: 2014-03-05 17:36:52.952608
|
||||||
revision = '5ac1c354a051'
|
revision = '5ac1c354a051'
|
||||||
down_revision = '538732fa21e1'
|
down_revision = '538732fa21e1'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.cisco.network_plugin.PluginV2'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
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
|
return
|
||||||
|
|
||||||
op.add_column(
|
op.add_column(
|
||||||
|
@ -69,5 +66,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
|
@ -31,12 +31,11 @@ down_revision = 'd06e871c0d5'
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'cisco_nexusport_bindings', 'vlan_id',
|
'cisco_nexusport_bindings', 'vlan_id',
|
||||||
nullable=False,
|
nullable=False,
|
||||||
|
@ -44,7 +43,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'cisco_nexusport_bindings', 'vlan_id',
|
'cisco_nexusport_bindings', 'vlan_id',
|
||||||
nullable=True,
|
nullable=True,
|
||||||
|
|
|
@ -25,23 +25,11 @@ Create Date: 2014-02-26 18:56:00.402855
|
||||||
revision = '81c553f3776c'
|
revision = '81c553f3776c'
|
||||||
down_revision = '24c7ea5160d7'
|
down_revision = '24c7ea5160d7'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2',
|
|
||||||
'neutron.plugins.ml2.plugin.Ml2Plugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
return
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'consistencyhashes',
|
'consistencyhashes',
|
||||||
sa.Column('hash_id', sa.String(255), primary_key=True),
|
sa.Column('hash_id', sa.String(255), primary_key=True),
|
||||||
|
@ -49,5 +37,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -30,7 +30,7 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
|
|
||||||
op.drop_table('cisco_ml2_apic_contracts')
|
op.drop_table('cisco_ml2_apic_contracts')
|
||||||
op.drop_table('cisco_ml2_apic_epgs')
|
op.drop_table('cisco_ml2_apic_epgs')
|
||||||
|
@ -43,7 +43,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
sa.PrimaryKeyConstraint('router_id'))
|
sa.PrimaryKeyConstraint('router_id'))
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
|
|
||||||
op.drop_table('cisco_ml2_apic_contracts')
|
op.drop_table('cisco_ml2_apic_contracts')
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ def _migrate_data(old_table, new_table):
|
||||||
{'new_table': new_table, 'old_table': old_table})
|
{'new_table': new_table, 'old_table': old_table})
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
op.add_column('router_extra_attributes',
|
op.add_column('router_extra_attributes',
|
||||||
sa.Column('service_router', sa.Boolean(),
|
sa.Column('service_router', sa.Boolean(),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
|
@ -56,7 +56,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
op.drop_table('nsxrouterextattributess')
|
op.drop_table('nsxrouterextattributess')
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'nsxrouterextattributess',
|
'nsxrouterextattributess',
|
||||||
sa.Column('router_id', sa.String(length=36), nullable=False),
|
sa.Column('router_id', sa.String(length=36), nullable=False),
|
||||||
|
|
|
@ -28,7 +28,7 @@ from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'nuage_provider_net_bindings',
|
'nuage_provider_net_bindings',
|
||||||
sa.Column('network_id', sa.String(length=36), nullable=False),
|
sa.Column('network_id', sa.String(length=36), nullable=False),
|
||||||
|
@ -41,5 +41,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
op.drop_table('nuage_provider_net_bindings')
|
op.drop_table('nuage_provider_net_bindings')
|
||||||
|
|
|
@ -25,11 +25,6 @@ Create Date: 2014-02-24 20:14:59.577972
|
||||||
revision = 'abc88c33f74f'
|
revision = 'abc88c33f74f'
|
||||||
down_revision = '3d2585038b95'
|
down_revision = '3d2585038b95'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
@ -37,10 +32,8 @@ import sqlalchemy as sa
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
if migration.schema_has_table('poolstatisticss'):
|
||||||
return
|
|
||||||
|
|
||||||
op.alter_column('poolstatisticss', 'bytes_in',
|
op.alter_column('poolstatisticss', 'bytes_in',
|
||||||
type_=sa.BigInteger(), existing_type=sa.Integer())
|
type_=sa.BigInteger(), existing_type=sa.Integer())
|
||||||
op.alter_column('poolstatisticss', 'bytes_out',
|
op.alter_column('poolstatisticss', 'bytes_out',
|
||||||
|
@ -51,5 +44,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
type_=sa.BigInteger(), existing_type=sa.Integer())
|
type_=sa.BigInteger(), existing_type=sa.Integer())
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -35,12 +35,12 @@ from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'firewall_rules', 'protocol',
|
'firewall_rules', 'protocol',
|
||||||
type_=sa.String(40),
|
type_=sa.String(40),
|
||||||
existing_nullable=True)
|
existing_nullable=True)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -32,12 +32,11 @@ down_revision = '4eca4a84f08a'
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'ml2_brocadeports', 'admin_state_up',
|
'ml2_brocadeports', 'admin_state_up',
|
||||||
nullable=False,
|
nullable=False,
|
||||||
|
@ -45,7 +44,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
|
|
||||||
|
|
||||||
@migration.skip_if_offline
|
@migration.skip_if_offline
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
migration.alter_column_if_exists(
|
migration.alter_column_if_exists(
|
||||||
'ml2_brocadeports', 'admin_state_up',
|
'ml2_brocadeports', 'admin_state_up',
|
||||||
nullable=True,
|
nullable=True,
|
||||||
|
|
|
@ -25,13 +25,6 @@ Create Date: 2013-11-17 10:09:37.728903
|
||||||
revision = 'e197124d4b9'
|
revision = 'e197124d4b9'
|
||||||
down_revision = 'havana'
|
down_revision = 'havana'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin',
|
|
||||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
@ -41,10 +34,8 @@ CONSTRAINT_NAME = 'uniq_member0pool_id0address0port'
|
||||||
TABLE_NAME = 'members'
|
TABLE_NAME = 'members'
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
if migration.schema_has_table(TABLE_NAME):
|
||||||
return
|
|
||||||
|
|
||||||
op.create_unique_constraint(
|
op.create_unique_constraint(
|
||||||
name=CONSTRAINT_NAME,
|
name=CONSTRAINT_NAME,
|
||||||
source=TABLE_NAME,
|
source=TABLE_NAME,
|
||||||
|
@ -52,5 +43,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
|
@ -25,18 +25,17 @@ Create Date: 2014-02-14 18:03:14.841064
|
||||||
revision = 'e766b19a3bb'
|
revision = 'e766b19a3bb'
|
||||||
down_revision = '1b2580001654'
|
down_revision = '1b2580001654'
|
||||||
|
|
||||||
migration_for_plugins = [
|
|
||||||
'neutron.plugins.nuage.plugin.NuagePlugin'
|
|
||||||
]
|
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from neutron.db import migration
|
from neutron.db import migration
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
|
||||||
|
if not migration.schema_has_table('routers'):
|
||||||
|
# In the database we are migrating from, the configured plugin
|
||||||
|
# did not create the routers table.
|
||||||
return
|
return
|
||||||
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
|
@ -95,5 +94,5 @@ def upgrade(active_plugins=None, options=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -47,7 +47,7 @@ from neutron.db.migration.alembic_migrations import vmware_init_ops
|
||||||
from neutron.db.migration.alembic_migrations import vpn_init_ops
|
from neutron.db.migration.alembic_migrations import vpn_init_ops
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
def upgrade():
|
||||||
agent_init_ops.upgrade()
|
agent_init_ops.upgrade()
|
||||||
core_init_ops.upgrade()
|
core_init_ops.upgrade()
|
||||||
l3_init_ops.upgrade()
|
l3_init_ops.upgrade()
|
||||||
|
@ -70,7 +70,7 @@ def upgrade(active_plugins=None, options=None):
|
||||||
vmware_init_ops.upgrade()
|
vmware_init_ops.upgrade()
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
vmware_init_ops.downgrade()
|
vmware_init_ops.downgrade()
|
||||||
ryu_init_ops.downgrade()
|
ryu_init_ops.downgrade()
|
||||||
other_plugins_init_ops.downgrade()
|
other_plugins_init_ops.downgrade()
|
||||||
|
|
|
@ -25,17 +25,13 @@ Create Date: 2013-03-28 00:00:00.000000
|
||||||
revision = 'icehouse'
|
revision = 'icehouse'
|
||||||
down_revision = '5ac1c354a051'
|
down_revision = '5ac1c354a051'
|
||||||
|
|
||||||
# Change to ['*'] if this migration applies to all plugins
|
|
||||||
|
|
||||||
migration_for_plugins = ['*']
|
def upgrade():
|
||||||
|
|
||||||
|
|
||||||
def upgrade(active_plugins=None, options=None):
|
|
||||||
"""A no-op migration for marking the Icehouse release."""
|
"""A no-op migration for marking the Icehouse release."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def downgrade(active_plugins=None, options=None):
|
def downgrade():
|
||||||
# We are purging all downgrade methods from icehouse to havana because:
|
# We are purging all downgrade methods from icehouse to havana because:
|
||||||
# 1) havana is going to become unsupported during Kilo cycle.
|
# 1) havana is going to become unsupported during Kilo cycle.
|
||||||
# 2) most people will upgrade from icehouse, while a minor percentage
|
# 2) most people will upgrade from icehouse, while a minor percentage
|
||||||
|
|
|
@ -35,13 +35,6 @@ class TestDbMigration(base.BaseTestCase):
|
||||||
self.mock_sa_inspector = mock.patch(
|
self.mock_sa_inspector = mock.patch(
|
||||||
'sqlalchemy.engine.reflection.Inspector').start()
|
'sqlalchemy.engine.reflection.Inspector').start()
|
||||||
|
|
||||||
def test_should_run_plugin_in_list(self):
|
|
||||||
self.assertTrue(migration.should_run(['foo'], ['foo', 'bar']))
|
|
||||||
self.assertFalse(migration.should_run(['foo'], ['bar']))
|
|
||||||
|
|
||||||
def test_should_run_plugin_wildcard(self):
|
|
||||||
self.assertTrue(migration.should_run(['foo'], ['*']))
|
|
||||||
|
|
||||||
def _prepare_mocked_sqlalchemy_inspector(self):
|
def _prepare_mocked_sqlalchemy_inspector(self):
|
||||||
mock_inspector = mock.MagicMock()
|
mock_inspector = mock.MagicMock()
|
||||||
mock_inspector.get_table_names.return_value = ['foo', 'bar']
|
mock_inspector.get_table_names.return_value = ['foo', 'bar']
|
||||||
|
|
Loading…
Reference in New Issue