Merge "Block downgrade from icehouse to havana"

This commit is contained in:
Jenkins 2014-08-30 20:01:37 +00:00 committed by Gerrit Code Review
commit 02c3e87f5a
28 changed files with 36 additions and 238 deletions

View File

@ -179,30 +179,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
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(
'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(
'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(
'ofcfilters',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('id')
)
pass

View File

@ -67,8 +67,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('lsn_port')
op.drop_table('lsn')
pass

View File

@ -47,7 +47,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_column('ml2_port_bindings', 'profile')
pass

View File

@ -79,22 +79,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('networkgatewaydevices')
# Re-create previous version of networkgatewaydevices table
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'))
# Copy from networkgatewaydevicereferences to networkgatewaydevices
op.execute("INSERT INTO networkgatewaydevices SELECT "
"id, network_gateway_id, interface_name FROM "
"networkgatewaydevicereferences")
# Dropt networkgatewaydevicereferences
op.drop_table('networkgatewaydevicereferences')
pass

View File

@ -56,6 +56,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('neutron_nsx_security_group_mappings')
pass

View File

@ -62,11 +62,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_constraint(
name=UC_NAME,
table_name=TABLE_NAME,
type_='unique'
)
pass

View File

@ -70,12 +70,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_column('subnets', 'ipv6_ra_mode')
op.drop_column('subnets', 'ipv6_address_mode')
context = op.get_context()
if context.bind.dialect.name == 'postgresql':
op.execute('DROP TYPE ipv6_ra_modes')
op.execute('DROP TYPE ipv6_address_modes')
pass

View File

@ -54,7 +54,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('cisco_csr_identifier_map')
pass

View File

@ -48,7 +48,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_column('ml2_port_bindings', 'vnic_type')
pass

View File

@ -73,7 +73,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_column('floatingips', 'last_known_router_id')
op.drop_column('floatingips', 'status')
pass

View File

@ -53,7 +53,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table(u'embrane_pool_port')
pass

View File

@ -53,13 +53,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
engine = op.get_bind().engine
if engine.name == 'postgresql':
op.execute("ALTER TYPE tz_network_bindings_binding_type "
"RENAME TO nvp_network_bindings_binding_type;")
op.rename_table('multi_provider_networks', 'nvp_multi_provider_networks')
op.rename_table('tz_network_bindings', 'nvp_network_bindings')
pass

View File

@ -55,7 +55,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('neutron_nsx_network_mappings')
pass

View File

@ -63,8 +63,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('ml2_brocadeports')
op.drop_table('ml2_brocadenetworks')
pass

View File

@ -58,7 +58,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('neutron_nsx_router_mappings')
pass

View File

@ -68,30 +68,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
if op.get_bind().engine.name == 'ibm_db_sa':
# Note(xuhanp): DB2 doesn't allow nullable=False Column with
# "DEFAULT" clause not specified. So server_default is used.
# Using sa.text will result "DEFAULT 0" for cap_port_filter.
op.add_column('ml2_port_bindings',
sa.Column('cap_port_filter', sa.Boolean(),
nullable=False,
server_default=sa.text("0")))
op.execute(
"UPDATE ml2_port_bindings SET"
" cap_port_filter = 1"
" WHERE vif_details LIKE '%\"port_filter\": true%'")
else:
op.add_column('ml2_port_bindings',
sa.Column('cap_port_filter', sa.Boolean(),
nullable=False,
server_default=sa.text("false")))
op.execute(
"UPDATE ml2_port_bindings SET"
" cap_port_filter = true"
" WHERE vif_details LIKE '%\"port_filter\": true%'")
op.drop_column('ml2_port_bindings', 'vif_details')
if op.get_bind().engine.name == 'ibm_db_sa':
op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
pass

View File

@ -62,19 +62,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
# Restore table to pre-icehouse version
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=False),
sa.ForeignKeyConstraint(['quantum_id'], ['ports.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('quantum_id'))
op.execute("INSERT INTO quantum_nvp_port_mapping SELECT neutron_id as "
"quantum_id, nsx_port_id as nvp_id from"
" neutron_nsx_port_mappings")
op.drop_table('neutron_nsx_port_mappings')
pass

View File

@ -52,14 +52,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
for table in ['ofctenantmappings', 'ofcnetworkmappings',
'ofcportmappings', 'ofcfiltermappings',
'ofcroutermappings',
]:
op.alter_column(table, 'neutron_id',
new_column_name='quantum_id',
existing_type=sa.String(length=36),
existing_nullable=False)
pass

View File

@ -70,14 +70,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_constraint('cisco_n1kv_vxlan_allocations_ibfk_1',
'cisco_n1kv_vxlan_allocations',
'foreignkey')
op.drop_column('cisco_n1kv_vxlan_allocations', 'network_profile_id')
op.drop_constraint('cisco_n1kv_vlan_allocations_ibfk_1',
'cisco_n1kv_vlan_allocations',
'foreignkey')
op.drop_column('cisco_n1kv_vlan_allocations', 'network_profile_id')
pass

View File

@ -50,7 +50,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('consistencyhashes')
pass

View File

@ -53,7 +53,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('quotas')
pass

View File

@ -52,14 +52,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.alter_column('poolstatisticss', 'bytes_in',
type_=sa.Integer(), existing_type=sa.BigInteger())
op.alter_column('poolstatisticss', 'bytes_out',
type_=sa.Integer(), existing_type=sa.BigInteger())
op.alter_column('poolstatisticss', 'active_connections',
type_=sa.Integer(), existing_type=sa.BigInteger())
op.alter_column('poolstatisticss', 'total_connections',
type_=sa.Integer(), existing_type=sa.BigInteger())
pass

View File

@ -53,11 +53,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_constraint(
CONSTRAINT_NAME,
TABLE_NAME,
type_='unique'
)
pass

View File

@ -107,14 +107,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('router_zone_mapping')
op.drop_table('net_partition_router_mapping')
op.drop_table('subnet_l2dom_mapping')
op.drop_table('port_mapping')
op.drop_table('net_partitions')
op.drop_table('quotas')
common_ext_ops.downgrade_l3()
pass

View File

@ -54,9 +54,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
### commands auto generated by Alembic - please adjust! ###
op.drop_table('quotas')
### end Alembic commands ###
pass

View File

@ -83,12 +83,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
### commands auto generated by Alembic - please adjust! ###
op.drop_table('securitygroupportbindings')
op.drop_table('securitygrouprules')
securitygrouprules_direction.drop(op.get_bind(), checkfirst=False)
op.drop_table('securitygroups')
### end Alembic commands ###
pass

View File

@ -52,7 +52,4 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('allowedaddresspairs')
pass

View File

@ -36,5 +36,12 @@ def upgrade(active_plugins=None, options=None):
def downgrade(active_plugins=None, options=None):
"""A no-op migration for marking the Icehouse release."""
pass
# We are purging all downgrade methods from icehouse to havana because:
# 1) havana is going to become unsupported during Kilo cycle.
# 2) most people will upgrade from icehouse, while a minor percentage
# from havana
# 3) downgrade use cases are mostly to revert after failed upgrades
# See discussion in https://review.openstack.org/109952 for details
raise NotImplementedError("Downgrade from icehouse to havana not "
"supported")