Kilo initial migration

Juno will be deprecated with Mitaka release, so juno_initial migration
should be replaced with kilo_initilal migration in Mitaka.

Optimized execution time of "upgrade head" command.
Test on my local machine on MySQL shows about 28% reduce (from 188
seconds to 137 seconds).

Related-Bug: #1501380

Change-Id: I26571f1c43764a01d1ae9869ce43ff18ea677892
This commit is contained in:
Ann Kamyshnikova 2015-10-28 16:25:29 +03:00 committed by Ihar Hrachyshka
parent f95dce7785
commit ceb9c40d66
48 changed files with 253 additions and 1717 deletions

View File

@ -37,6 +37,7 @@ def upgrade():
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.Column('load', sa.Integer(), server_default='0', nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('agent_type', 'host',
name='uniq_agents0agent_type0host'))

View File

@ -44,7 +44,8 @@ def upgrade():
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.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.PrimaryKeyConstraint('id'))
op.create_table(
@ -54,6 +55,7 @@ def upgrade():
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.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.PrimaryKeyConstraint('id'),
sa.ForeignKeyConstraint(['network_id'], ['ml2_brocadenetworks.id']))

View File

@ -22,6 +22,8 @@ segment_type = sa.Enum('vlan', 'overlay', 'trunk', 'multi-segment',
name='segment_type')
profile_type = sa.Enum('network', 'policy', name='profile_type')
network_profile_type = sa.Enum('vlan', 'vxlan', name='network_profile_type')
def upgrade():
op.create_table(
@ -189,13 +191,14 @@ def upgrade():
op.create_table(
'cisco_ml2_apic_contracts',
sa.Column('tenant_id', sa.String(length=255)),
sa.Column('tenant_id', sa.String(length=255), index=True),
sa.Column('router_id', sa.String(length=36), 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('tenant_id', sa.String(length=255), nullable=True,
index=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),
@ -235,3 +238,85 @@ def upgrade():
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('router_id')
)
op.create_table(
'cisco_ml2_n1kv_policy_profiles',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('vsm_ip', sa.String(length=16), nullable=False),
sa.PrimaryKeyConstraint('id', 'vsm_ip'),
)
op.create_table(
'cisco_ml2_n1kv_network_profiles',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('segment_type', network_profile_type, nullable=False),
sa.Column('segment_range', sa.String(length=255), nullable=True),
sa.Column('multicast_ip_index', sa.Integer(), nullable=True),
sa.Column('multicast_ip_range', sa.String(length=255), nullable=True),
sa.Column('sub_type', sa.String(length=255), nullable=True),
sa.Column('physical_network', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_table(
'cisco_ml2_n1kv_port_bindings',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'),
)
op.create_table(
'cisco_ml2_n1kv_network_bindings',
sa.Column('network_id', sa.String(length=36), nullable=False),
sa.Column('network_type', sa.String(length=32), nullable=False),
sa.Column('segmentation_id', sa.Integer(), autoincrement=False),
sa.Column('profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['profile_id'],
['cisco_ml2_n1kv_network_profiles.id']),
sa.PrimaryKeyConstraint('network_id')
)
op.create_table(
'cisco_ml2_n1kv_vxlan_allocations',
sa.Column('vxlan_id', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('allocated', sa.Boolean(), nullable=False),
sa.Column('network_profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['network_profile_id'],
['cisco_ml2_n1kv_network_profiles.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('vxlan_id')
)
op.create_table(
'cisco_ml2_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.Column('network_profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['network_profile_id'],
['cisco_ml2_n1kv_network_profiles.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('physical_network', 'vlan_id')
)
op.create_table(
'cisco_ml2_n1kv_profile_bindings',
sa.Column('profile_type', profile_type, nullable=True),
sa.Column('tenant_id', sa.String(length=36), nullable=False,
server_default='tenant_id_not_set'),
sa.Column('profile_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('tenant_id', 'profile_id')
)
op.create_table(
'ml2_ucsm_port_profiles',
sa.Column('vlan_id', sa.Integer(), nullable=False),
sa.Column('profile_id', sa.String(length=64), nullable=False),
sa.Column('created_on_ucs', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('vlan_id')
)

View File

@ -21,17 +21,21 @@ import sqlalchemy as sa
def upgrade():
op.create_table(
'networks',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('status', sa.String(length=16), nullable=True),
sa.Column('admin_state_up', sa.Boolean(), nullable=True),
sa.Column('shared', sa.Boolean(), nullable=True),
sa.Column('mtu', sa.Integer(), nullable=True),
sa.Column('vlan_transparent', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table(
'ports',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('network_id', sa.String(length=36), nullable=False),
@ -40,12 +44,19 @@ def upgrade():
sa.Column('status', sa.String(length=16), nullable=False),
sa.Column('device_id', sa.String(length=255), nullable=False),
sa.Column('device_owner', sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ),
sa.PrimaryKeyConstraint('id'))
sa.ForeignKeyConstraint(['network_id'], ['networks.id']),
sa.UniqueConstraint('network_id', 'mac_address',
name='uniq_ports0network_id0mac_address'),
sa.PrimaryKeyConstraint('id'),
sa.Index(op.f('ix_ports_network_id_device_owner'), 'network_id',
'device_owner'),
sa.Index(op.f('ix_ports_network_id_mac_address'), 'network_id',
'mac_address'))
op.create_table(
'subnets',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('network_id', sa.String(length=36), nullable=True),
@ -62,6 +73,8 @@ def upgrade():
sa.Enum('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless',
name='ipv6_address_modes'),
nullable=True),
sa.Column('subnetpool_id', sa.String(length=36), nullable=True,
index=True),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ),
sa.PrimaryKeyConstraint('id'))
@ -112,7 +125,13 @@ def upgrade():
sa.Column('last_ip', sa.String(length=64), nullable=False),
sa.ForeignKeyConstraint(['allocation_pool_id'],
['ipallocationpools.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('allocation_pool_id', 'first_ip', 'last_ip'))
sa.PrimaryKeyConstraint('allocation_pool_id', 'first_ip', 'last_ip'),
sa.UniqueConstraint(
'first_ip', 'allocation_pool_id',
name='uniq_ipavailabilityranges0first_ip0allocation_pool_id'),
sa.UniqueConstraint(
'last_ip', 'allocation_pool_id',
name='uniq_ipavailabilityranges0last_ip0allocation_pool_id'))
op.create_table(
'networkdhcpagentbindings',

View File

@ -39,14 +39,9 @@ def upgrade():
nullable=False, server_default='normal'),
sa.Column('profile', sa.String(length=4095),
nullable=False, server_default=''),
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(u'status', sa.String(16), nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['segment'], ['ml2_network_segments.id'],
ondelete='SET NULL'),
sa.PrimaryKeyConstraint('port_id', 'host')
)
op.create_table(
@ -61,5 +56,5 @@ def upgrade():
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['csnat_gw_port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('router_id')
sa.PrimaryKeyConstraint('router_id', 'l3_agent_id')
)

View File

@ -42,7 +42,8 @@ def upgrade():
op.create_table(
'routers',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('status', sa.String(length=16), nullable=True),
@ -55,7 +56,8 @@ def upgrade():
op.create_table(
'floatingips',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('floating_ip_address', sa.String(length=64), nullable=False),
sa.Column('floating_network_id', sa.String(length=36), nullable=False),
@ -66,7 +68,8 @@ def upgrade():
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(['floating_port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ),
sa.PrimaryKeyConstraint('id'))

View File

@ -27,7 +27,8 @@ direction = sa.Enum('ingress', 'egress',
def create_meteringlabels():
op.create_table(
'meteringlabels',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
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),

View File

@ -27,18 +27,24 @@ def upgrade():
sa.Column('vlan_id', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('allocated', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('physical_network', 'vlan_id'))
sa.PrimaryKeyConstraint('physical_network', 'vlan_id'),
sa.Index(op.f('ix_ml2_vlan_allocations_physical_network_allocated'),
'physical_network', 'allocated'))
op.create_table(
'ml2_vxlan_endpoints',
sa.Column('ip_address', sa.String(length=64), nullable=False),
sa.Column('udp_port', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('host', sa.String(length=255), nullable=True),
sa.UniqueConstraint('host', name='unique_ml2_vxlan_endpoints0host'),
sa.PrimaryKeyConstraint('ip_address'))
op.create_table(
'ml2_gre_endpoints',
sa.Column('ip_address', sa.String(length=64), nullable=False),
sa.Column('host', sa.String(length=255), nullable=True),
sa.UniqueConstraint('host', name='unique_ml2_gre_endpoints0host'),
sa.PrimaryKeyConstraint('ip_address'))
op.create_table(
@ -46,7 +52,7 @@ def upgrade():
sa.Column('vxlan_vni', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('allocated', sa.Boolean(), nullable=False,
server_default=sa.sql.false()),
server_default=sa.sql.false(), index=True),
sa.PrimaryKeyConstraint('vxlan_vni'))
op.create_table(
@ -54,7 +60,7 @@ def upgrade():
sa.Column('gre_id', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('allocated', sa.Boolean(), nullable=False,
server_default=sa.sql.false()),
server_default=sa.sql.false(), index=True),
sa.PrimaryKeyConstraint('gre_id'))
op.create_table(
@ -71,6 +77,8 @@ def upgrade():
sa.Column('segmentation_id', sa.Integer(), nullable=True),
sa.Column('is_dynamic', sa.Boolean(), nullable=False,
server_default=sa.sql.false()),
sa.Column('segment_index', sa.Integer(), nullable=False,
server_default='0'),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'))
@ -81,8 +89,6 @@ def upgrade():
sa.Column('host', sa.String(length=255), nullable=False,
server_default=''),
sa.Column('vif_type', sa.String(length=64), 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,
@ -91,10 +97,21 @@ def upgrade():
server_default=''),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['segment'], ['ml2_network_segments.id'],
ondelete='SET NULL'),
sa.PrimaryKeyConstraint('port_id'))
op.create_table(
'ml2_port_binding_levels',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('host', sa.String(length=255), nullable=False),
sa.Column('level', sa.Integer(), autoincrement=False, nullable=False),
sa.Column('driver', sa.String(length=64), nullable=True),
sa.Column('segment_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['segment_id'], ['ml2_network_segments.id'],
ondelete='SET NULL'),
sa.PrimaryKeyConstraint('port_id', 'host', 'level')
)
op.create_table(
'cisco_ml2_nexusport_bindings',
sa.Column('binding_id', sa.Integer(), nullable=False),
@ -103,12 +120,16 @@ def upgrade():
nullable=False),
sa.Column('switch_ip', sa.String(length=255), nullable=True),
sa.Column('instance_id', sa.String(length=255), nullable=True),
sa.Column('vni', sa.Integer(), nullable=True),
sa.Column('is_provider_vlan', sa.Boolean(), nullable=False,
server_default=sa.sql.false()),
sa.PrimaryKeyConstraint('binding_id'),
)
op.create_table(
'arista_provisioned_nets',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('network_id', sa.String(length=36), nullable=True),
sa.Column('segmentation_id', sa.Integer(),
@ -117,7 +138,8 @@ def upgrade():
op.create_table(
'arista_provisioned_vms',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('vm_id', sa.String(length=255), nullable=True),
sa.Column('host_id', sa.String(length=255), nullable=True),
@ -127,6 +149,35 @@ def upgrade():
op.create_table(
'arista_provisioned_tenants',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('id'))
op.create_table(
'ml2_nexus_vxlan_allocations',
sa.Column('vxlan_vni', sa.Integer(), nullable=False,
autoincrement=False),
sa.Column('allocated', sa.Boolean(), nullable=False,
server_default=sa.sql.false()),
sa.PrimaryKeyConstraint('vxlan_vni')
)
op.create_table(
'ml2_nexus_vxlan_mcast_groups',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('mcast_group', sa.String(length=64), nullable=False),
sa.Column('associated_vni', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.ForeignKeyConstraint(['associated_vni'],
['ml2_nexus_vxlan_allocations.vxlan_vni'],
ondelete='CASCADE')
)
op.create_table(
'cisco_ml2_nexus_nve',
sa.Column('vni', sa.Integer(), nullable=False),
sa.Column('switch_ip', sa.String(length=255), nullable=True),
sa.Column('device_id', sa.String(length=255), nullable=True),
sa.Column('mcast_group', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('vni', 'switch_ip', 'device_id'))

View File

@ -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.
#
# Initial operations for the Mellanox plugin
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'segmentation_id_allocation',
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,
server_default=sa.sql.false()),
sa.PrimaryKeyConstraint('physical_network', 'segmentation_id'))
op.create_table(
'mlnx_network_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=True),
sa.Column('segmentation_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'))
op.create_table(
'port_profile',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('vnic_type', sa.String(length=32), nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'))

View File

@ -66,7 +66,8 @@ def upgrade():
op.create_table(
'packetfilters',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('network_id', sa.String(length=36), nullable=False),

View File

@ -13,17 +13,6 @@
# under the License.
#
"""nsxv
Revision ID: 4dbe243cd84d
Revises: 38495dc99731
Create Date: 2015-01-05 23:22:04.501609
"""
# revision identifiers, used by Alembic.
revision = '4dbe243cd84d'
down_revision = '38495dc99731'
from alembic import op
import sqlalchemy as sa

View File

@ -27,17 +27,21 @@ def upgrade():
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('l3dom_tmplt_id', sa.String(length=36), nullable=True),
sa.Column('l2dom_tmplt_id', sa.String(length=36), nullable=True),
sa.Column('isolated_zone', sa.String(length=64), nullable=True),
sa.Column('shared_zone', sa.String(length=64), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_table(
'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),
sa.Column('nuage_subnet_id', sa.String(length=36), nullable=True,
unique=True),
sa.Column('nuage_l2dom_tmplt_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.Column('nuage_managed_subnet', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['subnet_id'], ['subnets.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['net_partition_id'],
@ -49,7 +53,10 @@ def upgrade():
'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.Column('nuage_router_id', sa.String(length=36), nullable=True,
unique=True),
sa.Column('nuage_rtr_rd', sa.String(length=36), nullable=True),
sa.Column('nuage_rtr_rt', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['net_partition_id'],
['nuage_net_partitions.id'],
ondelete='CASCADE'),

View File

@ -64,22 +64,36 @@ def upgrade():
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('opt_name', sa.String(length=64), nullable=False),
sa.Column('opt_value', sa.String(length=255), nullable=False),
sa.Column('ip_version', sa.Integer(), server_default='4',
nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('port_id', 'opt_name', name='uidx_portid_optname'))
sa.UniqueConstraint(
'port_id', 'opt_name', 'ip_version',
name='uniq_extradhcpopts0portid0optname0ipversion'))
op.create_table(
'routerservicetypebindings',
sa.Column('router_id', sa.String(length=36), nullable=False),
sa.Column('service_type_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('router_id'))
op.create_table(
'servicerouterbindings',
sa.Column('resource_id', sa.String(length=36), nullable=False),
sa.Column('resource_type', sa.String(length=36), nullable=False),
sa.Column('router_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'], ),
sa.PrimaryKeyConstraint('resource_id', 'resource_type'))
op.create_table('subnetpools',
sa.Column('tenant_id',
sa.String(length=255),
nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('ip_version', sa.Integer(), nullable=False),
sa.Column('default_prefixlen',
sa.Integer(),
nullable=False),
sa.Column('min_prefixlen', sa.Integer(), nullable=False),
sa.Column('max_prefixlen', sa.Integer(), nullable=False),
sa.Column('shared', sa.Boolean(), nullable=False),
sa.Column('default_quota', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table('subnetpoolprefixes',
sa.Column('cidr', sa.String(length=64), nullable=False),
sa.Column('subnetpool_id',
sa.String(length=36),
nullable=False),
sa.ForeignKeyConstraint(['subnetpool_id'],
['subnetpools.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('cidr', 'subnetpool_id'))

View File

@ -14,7 +14,6 @@
#
# Initial operations for plugins:
# hyper-v
# bigswitch
# metaplugin
@ -24,25 +23,6 @@ import sqlalchemy as sa
def upgrade():
# hyper-v
op.create_table(
'hyperv_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(), nullable=False),
sa.PrimaryKeyConstraint('physical_network', 'vlan_id'))
op.create_table(
'hyperv_network_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=True),
sa.Column('segmentation_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'))
# metaplugin
op.create_table(
'networkflavors',

View File

@ -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.
#
# Initial operations for the Ryu plugin
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'tunnelkeylasts',
sa.Column('last_key', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('last_key'))
op.create_table(
'tunnelkeys',
sa.Column('network_id', sa.String(length=36), nullable=False),
sa.Column('tunnel_key', sa.Integer(), autoincrement=False,
nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'], ),
sa.PrimaryKeyConstraint('tunnel_key'))

View File

@ -25,7 +25,8 @@ rule_direction_enum = sa.Enum('ingress', 'egress',
def upgrade():
op.create_table(
'securitygroups',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('description', sa.String(length=255), nullable=True),
@ -33,7 +34,8 @@ def upgrade():
op.create_table(
'securitygrouprules',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('security_group_id', sa.String(length=36), nullable=False),
sa.Column('remote_group_id', sa.String(length=36), nullable=True),
@ -56,3 +58,12 @@ def upgrade():
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['security_group_id'], ['securitygroups.id']),
sa.PrimaryKeyConstraint('port_id', 'security_group_id'))
op.create_table(
'default_security_group',
sa.Column('tenant_id', sa.String(length=255), nullable=False),
sa.Column('security_group_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('tenant_id'),
sa.ForeignKeyConstraint(['security_group_id'],
['securitygroups.id'],
ondelete="CASCADE"))

View File

@ -1,28 +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 allow_overlap from subnetpools
"""
# revision identifiers, used by Alembic.
revision = '034883111f'
down_revision = '20b99fd19d4f'
from alembic import op
def upgrade():
op.drop_column('subnetpools', 'allow_overlap')

View File

@ -1,95 +0,0 @@
# 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
# 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 default security group table
Revision ID: 14be42f3d0a5
Revises: 41662e32bce2
Create Date: 2014-12-12 14:54:11.123635
"""
# revision identifiers, used by Alembic.
revision = '14be42f3d0a5'
down_revision = '26b54cf9024d'
from alembic import op
import six
import sqlalchemy as sa
from neutron._i18n import _
from neutron.common import exceptions
# Models can change in time, but migration should rely only on exact
# model state at the current moment, so a separate model is created
# here.
security_group = sa.Table('securitygroups', sa.MetaData(),
sa.Column('id', sa.String(length=36),
nullable=False),
sa.Column('name', sa.String(255)),
sa.Column('tenant_id', sa.String(255)))
class DuplicateSecurityGroupsNamedDefault(exceptions.Conflict):
message = _("Some tenants have more than one security group named "
"'default': %(duplicates)s. All duplicate 'default' security "
"groups must be resolved before upgrading the database.")
def upgrade():
table = op.create_table(
'default_security_group',
sa.Column('tenant_id', sa.String(length=255), nullable=False),
sa.Column('security_group_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('tenant_id'),
sa.ForeignKeyConstraint(['security_group_id'],
['securitygroups.id'],
ondelete="CASCADE"))
sel = (sa.select([security_group.c.tenant_id,
security_group.c.id])
.where(security_group.c.name == 'default'))
ins = table.insert(inline=True).from_select(['tenant_id',
'security_group_id'], sel)
op.execute(ins)
def check_sanity(connection):
res = get_duplicate_default_security_groups(connection)
if res:
raise DuplicateSecurityGroupsNamedDefault(
duplicates='; '.join('tenant %s: %s' %
(tenant_id, ', '.join(groups))
for tenant_id, groups in six.iteritems(res)))
def get_duplicate_default_security_groups(connection):
insp = sa.engine.reflection.Inspector.from_engine(connection)
if 'securitygroups' not in insp.get_table_names():
return {}
session = sa.orm.Session(bind=connection.connect())
subq = (session.query(security_group.c.tenant_id)
.filter(security_group.c.name == 'default')
.group_by(security_group.c.tenant_id)
.having(sa.func.count() > 1)
.subquery())
sg = (session.query(security_group)
.join(subq, security_group.c.tenant_id == subq.c.tenant_id)
.filter(security_group.c.name == 'default')
.all())
res = {}
for s in sg:
res.setdefault(s.tenant_id, []).append(s.id)
return res

View File

@ -1,54 +0,0 @@
# 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
# 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.
#
"""extra_dhcp_options IPv6 support
Revision ID: 16cdf118d31d
Revises: 14be42f3d0a5
Create Date: 2014-10-23 17:04:19.796731
"""
# revision identifiers, used by Alembic.
revision = '16cdf118d31d'
down_revision = '14be42f3d0a5'
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
CONSTRAINT_NAME_OLD = 'uidx_portid_optname'
CONSTRAINT_NAME_NEW = 'uniq_extradhcpopts0portid0optname0ipversion'
TABLE_NAME = 'extradhcpopts'
def upgrade():
with migration.remove_fks_from_table(TABLE_NAME):
op.drop_constraint(
constraint_name=CONSTRAINT_NAME_OLD,
table_name=TABLE_NAME,
type_='unique'
)
op.add_column('extradhcpopts', sa.Column('ip_version', sa.Integer(),
server_default='4', nullable=False))
op.execute("UPDATE extradhcpopts SET ip_version = 4")
op.create_unique_constraint(
constraint_name=CONSTRAINT_NAME_NEW,
table_name='extradhcpopts',
columns=['port_id', 'opt_name', 'ip_version']
)

View File

@ -1,35 +0,0 @@
# 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
# 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.
#
"""weight_scheduler
Revision ID: 1955efc66455
Revises: 35a0f3365720
Create Date: 2015-03-12 22:11:37.607390
"""
# revision identifiers, used by Alembic.
revision = '1955efc66455'
down_revision = '35a0f3365720'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('agents',
sa.Column('load', sa.Integer(),
server_default='0', nullable=False))

View File

@ -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_network_segments models change for multi-segment network.
Revision ID: 1f71e54a85e7
Revises: 44621190bc02
Create Date: 2014-10-15 18:30:51.395295
"""
# revision identifiers, used by Alembic.
revision = '1f71e54a85e7'
down_revision = '44621190bc02'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('ml2_network_segments',
sa.Column('segment_index', sa.Integer(), nullable=False,
server_default='0'))

View File

@ -1,40 +0,0 @@
# Copyright 2015 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 UCS Manager Mechanism Driver
Revision ID: 20b99fd19d4f
Revises: 589f9237ca0e
Create Date: 2014-07-30 21:01:13.754637
"""
# revision identifiers, used by Alembic.
revision = '20b99fd19d4f'
down_revision = '589f9237ca0e'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'ml2_ucsm_port_profiles',
sa.Column('vlan_id', sa.Integer(), nullable=False),
sa.Column('profile_id', sa.String(length=64), nullable=False),
sa.Column('created_on_ucs', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('vlan_id')
)

View File

@ -1,35 +0,0 @@
# 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
# 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 index for port
Revision ID: 20c469a5f920
Revises: 28a09af858a8
Create Date: 2015-04-01 04:12:49.898443
"""
# revision identifiers, used by Alembic.
revision = '20c469a5f920'
down_revision = '28a09af858a8'
from alembic import op
def upgrade():
op.create_index(op.f('ix_ports_network_id_device_owner'),
'ports', ['network_id', 'device_owner'], unique=False)
op.create_index(op.f('ix_ports_network_id_mac_address'),
'ports', ['network_id', 'mac_address'], unique=False)

View File

@ -1,33 +0,0 @@
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# 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.
#
"""Initial operations in support of subnet allocation from a pool
"""
revision = '268fb5e99aa2'
down_revision = '034883111f'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('subnets',
sa.Column('subnetpool_id',
sa.String(length=36),
nullable=True,
index=True))

View File

@ -1,41 +0,0 @@
# 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
# 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 index on allocated
Revision ID: 26b54cf9024d
Revises: 41662e32bce2
Create Date: 2015-01-20 15:49:46.100172
"""
# revision identifiers, used by Alembic.
revision = '26b54cf9024d'
down_revision = '2a1ee2fb59e0'
from alembic import op
def upgrade():
op.create_index(
op.f('ix_ml2_gre_allocations_allocated'),
'ml2_gre_allocations', ['allocated'], unique=False)
op.create_index(
op.f('ix_ml2_vxlan_allocations_allocated'),
'ml2_vxlan_allocations', ['allocated'], unique=False)
op.create_index(
op.f('ix_ml2_vlan_allocations_physical_network_allocated'),
'ml2_vlan_allocations', ['physical_network', 'allocated'],
unique=False)

View File

@ -1,36 +0,0 @@
# 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
# 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.
#
"""Initial operations to support basic quotas on prefix space in a subnet pool
Revision ID: 28a09af858a8
Revises: 268fb5e99aa2
Create Date: 2015-03-16 10:36:48.810741
"""
# revision identifiers, used by Alembic.
revision = '28a09af858a8'
down_revision = '268fb5e99aa2'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('subnetpools',
sa.Column('default_quota',
sa.Integer(),
nullable=True))

View File

@ -1,34 +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 mlnx plugin
Revision ID: 28c0ffb8ebbd
Revises: 408cfbf6923c
Create Date: 2014-12-08 23:58:49.288830
"""
# revision identifiers, used by Alembic.
revision = '28c0ffb8ebbd'
down_revision = '408cfbf6923c'
from alembic import op
def upgrade():
op.drop_table('mlnx_network_bindings')
op.drop_table('segmentation_id_allocation')
op.drop_table('port_profile')

View File

@ -1,39 +0,0 @@
# Copyright (c) 2015 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.
#
"""Add mac_address unique constraint
Revision ID: 2a1ee2fb59e0
Revises: 41662e32bce2
Create Date: 2015-01-10 11:44:27.550349
"""
# revision identifiers, used by Alembic.
revision = '2a1ee2fb59e0'
down_revision = '41662e32bce2'
from alembic import op
TABLE_NAME = 'ports'
CONSTRAINT_NAME = 'uniq_ports0network_id0mac_address'
def upgrade():
op.create_unique_constraint(
constraint_name=CONSTRAINT_NAME,
table_name=TABLE_NAME,
columns=['network_id', 'mac_address']
)

View File

@ -1,135 +0,0 @@
# 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
# 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 Hyper-V Neutron Plugin
Migrates the contents of the tables 'hyperv_vlan_allocations' and
'hyperv_network_bindings' to 'ml2_vlan_allocations' and 'ml2_network_segments'
respectively, and then removes the tables.
Thse tables are used by HyperVNeutronPlugin, which will be removed.
Revision ID: 2b801560a332
Revises: 4119216b7365
Create Date: 2015-02-12 09:23:40.346104
"""
# revision identifiers, used by Alembic.
revision = '2b801560a332'
down_revision = '2d2a8a565438'
from alembic import op
from oslo_utils import uuidutils
import sqlalchemy as sa
from sqlalchemy.sql import expression as sa_expr
from neutron.plugins.common import constants as p_const
FLAT_VLAN_ID = -1
LOCAL_VLAN_ID = -2
HYPERV = 'hyperv'
# Duplicated from neutron.plugins.linuxbridge.common.constants to
# avoid being dependent on it, as it will eventually be removed.
def _interpret_vlan_id(vlan_id):
"""Return (network_type, segmentation_id) tuple for encoded vlan_id."""
if vlan_id == LOCAL_VLAN_ID:
return (p_const.TYPE_LOCAL, None)
elif vlan_id == FLAT_VLAN_ID:
return (p_const.TYPE_FLAT, None)
else:
return (p_const.TYPE_VLAN, vlan_id)
def _migrate_segment_dict(binding):
binding['id'] = uuidutils.generate_uuid()
vlan_id = binding.pop('segmentation_id')
network_type, segmentation_id = _interpret_vlan_id(vlan_id)
binding['network_type'] = network_type
binding['segmentation_id'] = segmentation_id
def _migrate_vlan_allocations():
# Code similar to migrate_to_ml2.BaseMigrateToMl2.migrate_vlan_allocations
if op.get_bind().engine.name == 'ibm_db_sa':
op.execute('INSERT INTO ml2_vlan_allocations '
'SELECT physical_network, vlan_id, allocated '
'FROM hyperv_vlan_allocations '
'WHERE allocated = 1')
else:
op.execute('INSERT INTO ml2_vlan_allocations '
'SELECT physical_network, vlan_id, allocated '
'FROM hyperv_vlan_allocations '
'WHERE allocated = TRUE')
def _migrate_network_segments(engine):
# Code similar to migrate_to_ml2.BaseMigrateToMl2.migrate_network_segments
source_table = sa_expr.table('hyperv_network_bindings')
source_segments = engine.execute(
sa_expr.select(['*'], from_obj=source_table))
ml2_segments = [dict(x) for x in source_segments]
for segment in ml2_segments:
_migrate_segment_dict(segment)
if ml2_segments:
ml2_network_segments = sa_expr.table('ml2_network_segments')
op.execute(ml2_network_segments.insert(), ml2_segments)
def _get_port_segment_map(engine):
# Code from migrate_to_ml2.BaseMigrateToMl2.get_port_segment_map
port_segments = engine.execute("""
SELECT ports_network.port_id, ml2_network_segments.id AS segment_id
FROM ml2_network_segments, (
SELECT portbindingports.port_id, ports.network_id
FROM portbindingports, ports
WHERE portbindingports.port_id = ports.id
) AS ports_network
WHERE ml2_network_segments.network_id = ports_network.network_id
""")
return dict(x for x in port_segments)
def _migrate_port_bindings(engine):
# Code similar to migrate_to_ml2.BaseMigrateToMl2.migrate_port_bindings
port_segment_map = _get_port_segment_map(engine)
port_binding_ports = sa_expr.table('portbindingports')
source_bindings = engine.execute(
sa_expr.select(['*'], from_obj=port_binding_ports))
ml2_bindings = [dict(x) for x in source_bindings]
for binding in ml2_bindings:
binding['vif_type'] = 'hyperv'
binding['driver'] = HYPERV
segment = port_segment_map.get(binding['port_id'])
if segment:
binding['segment'] = segment
if ml2_bindings:
md = sa.MetaData()
sa.Table('ml2_port_bindings', md, autoload=True, autoload_with=engine)
op.bulk_insert(md.tables['ml2_port_bindings'], ml2_bindings)
def upgrade():
bind = op.get_bind()
_migrate_vlan_allocations()
_migrate_network_segments(bind)
_migrate_port_bindings(bind)
op.drop_table('hyperv_vlan_allocations')
op.drop_table('hyperv_network_bindings')

View File

@ -1,74 +0,0 @@
# 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
# 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 hierarchical binding
Revision ID: 2d2a8a565438
Revises: 4119216b7365
Create Date: 2014-08-24 21:56:36.422885
"""
# revision identifiers, used by Alembic.
revision = '2d2a8a565438'
down_revision = '4119216b7365'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.engine import reflection
port_binding_tables = ['ml2_port_bindings', 'ml2_dvr_port_bindings']
def upgrade():
inspector = reflection.Inspector.from_engine(op.get_bind())
fk_name = [fk['name'] for fk in
inspector.get_foreign_keys('ml2_port_bindings')
if 'segment' in fk['constrained_columns']]
fk_name_dvr = [fk['name'] for fk in
inspector.get_foreign_keys('ml2_dvr_port_bindings')
if 'segment' in fk['constrained_columns']]
op.create_table(
'ml2_port_binding_levels',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('host', sa.String(length=255), nullable=False),
sa.Column('level', sa.Integer(), autoincrement=False, nullable=False),
sa.Column('driver', sa.String(length=64), nullable=True),
sa.Column('segment_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['segment_id'], ['ml2_network_segments.id'],
ondelete='SET NULL'),
sa.PrimaryKeyConstraint('port_id', 'host', 'level')
)
for table in port_binding_tables:
op.execute((
"INSERT INTO ml2_port_binding_levels "
"SELECT port_id, host, 0 AS level, driver, segment AS segment_id "
"FROM %s "
"WHERE host <> '' "
"AND driver <> '';"
) % table)
op.drop_constraint(fk_name_dvr[0], 'ml2_dvr_port_bindings', 'foreignkey')
op.drop_column('ml2_dvr_port_bindings', 'cap_port_filter')
op.drop_column('ml2_dvr_port_bindings', 'segment')
op.drop_column('ml2_dvr_port_bindings', 'driver')
op.drop_constraint(fk_name[0], 'ml2_port_bindings', 'foreignkey')
op.drop_column('ml2_port_bindings', 'driver')
op.drop_column('ml2_port_bindings', 'segment')

View File

@ -1,67 +0,0 @@
# 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
# 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.
#
"""sync with cisco repo
Revision ID: 341ee8a4ccb5
Revises: f15b1fb526dd
Create Date: 2015-03-10 17:19:57.047080
"""
# revision identifiers, used by Alembic.
revision = '341ee8a4ccb5'
down_revision = 'f15b1fb526dd'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'ml2_nexus_vxlan_allocations',
sa.Column('vxlan_vni', sa.Integer(), nullable=False,
autoincrement=False),
sa.Column('allocated', sa.Boolean(), nullable=False,
server_default=sa.sql.false()),
sa.PrimaryKeyConstraint('vxlan_vni')
)
op.create_table(
'ml2_nexus_vxlan_mcast_groups',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('mcast_group', sa.String(length=64), nullable=False),
sa.Column('associated_vni', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.ForeignKeyConstraint(['associated_vni'],
['ml2_nexus_vxlan_allocations.vxlan_vni'],
ondelete='CASCADE')
)
op.create_table(
'cisco_ml2_nexus_nve',
sa.Column('vni', sa.Integer(), nullable=False),
sa.Column('switch_ip', sa.String(length=255), nullable=True),
sa.Column('device_id', sa.String(length=255), nullable=True),
sa.Column('mcast_group', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('vni', 'switch_ip', 'device_id'))
op.add_column(
'cisco_ml2_nexusport_bindings',
sa.Column('vni', sa.Integer(), nullable=True))
op.add_column('cisco_ml2_nexusport_bindings', sa.Column(
'is_provider_vlan', sa.Boolean(), nullable=False,
server_default=sa.sql.false()))

View File

@ -1,54 +0,0 @@
# 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
# 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 port-security in ml2
Revision ID: 35a0f3365720
Revises: 341ee8a4ccb5
Create Date: 2014-09-30 09:41:14.146519
"""
# revision identifiers, used by Alembic.
revision = '35a0f3365720'
down_revision = '341ee8a4ccb5'
from alembic import op
def upgrade():
context = op.get_context()
if context.bind.dialect.name == 'ibm_db_sa':
# NOTE(junxie): DB2 stores booleans as 0 and 1.
op.execute('INSERT INTO networksecuritybindings (network_id, '
'port_security_enabled) SELECT id, 1 FROM networks '
'WHERE id NOT IN (SELECT network_id FROM '
'networksecuritybindings);')
op.execute('INSERT INTO portsecuritybindings (port_id, '
'port_security_enabled) SELECT id, 1 FROM ports '
'WHERE id NOT IN (SELECT port_id FROM '
'portsecuritybindings);')
else:
op.execute('INSERT INTO networksecuritybindings (network_id, '
'port_security_enabled) SELECT id, True FROM networks '
'WHERE id NOT IN (SELECT network_id FROM '
'networksecuritybindings);')
op.execute('INSERT INTO portsecuritybindings (port_id, '
'port_security_enabled) SELECT id, True FROM ports '
'WHERE id NOT IN (SELECT port_id FROM '
'portsecuritybindings);')

View File

@ -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.
#
"""ml2_tunnel_endpoints_table
Revision ID: 38495dc99731
Revises: 57086602ca0a
Create Date: 2014-12-22 00:03:33.643799
"""
# revision identifiers, used by Alembic.
revision = '38495dc99731'
down_revision = '57086602ca0a'
from alembic import op
import sqlalchemy as sa
CONSTRAINT_NAME_GRE = 'unique_ml2_gre_endpoints0host'
CONSTRAINT_NAME_VXLAN = 'unique_ml2_vxlan_endpoints0host'
def upgrade():
op.add_column('ml2_gre_endpoints',
sa.Column('host', sa.String(length=255), nullable=True))
op.create_unique_constraint(
constraint_name=CONSTRAINT_NAME_GRE,
table_name='ml2_gre_endpoints',
columns=['host']
)
op.add_column('ml2_vxlan_endpoints',
sa.Column('host', sa.String(length=255), nullable=True))
op.create_unique_constraint(
constraint_name=CONSTRAINT_NAME_VXLAN,
table_name='ml2_vxlan_endpoints',
columns=['host']
)

View File

@ -1,33 +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 ryu plugin
Revision ID: 408cfbf6923c
Revises: 1f71e54a85e7
Create Date: 2014-11-10 13:17:12.709642
"""
# revision identifiers, used by Alembic.
revision = '408cfbf6923c'
down_revision = '1f71e54a85e7'
from alembic import op
def upgrade():
op.drop_table('tunnelkeylasts')
op.drop_table('tunnelkeys')

View File

@ -1,42 +0,0 @@
# 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
# 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 index on tenant_id column
Revision ID: 4119216b7365
Revises: 28c0ffb8ebbd
Create Date: 2014-12-19 12:21:54.439723
"""
# revision identifiers, used by Alembic.
revision = '4119216b7365'
down_revision = 'bebba223288'
from alembic import op
TABLES = ['floatingips', 'networkconnections', 'networkgatewaydevices',
'networks', 'packetfilters', 'ports', 'qosqueues', 'routers',
'securitygrouprules', 'securitygroups', 'subnets', 'meteringlabels',
'arista_provisioned_nets', 'arista_provisioned_tenants',
'arista_provisioned_vms', 'cisco_hosting_devices',
'cisco_ml2_apic_contracts', 'ml2_brocadenetworks',
'ml2_brocadeports']
def upgrade():
for table in TABLES:
op.create_index(op.f('ix_%s_tenant_id' % table),
table, ['tenant_id'], unique=False)

View File

@ -1,49 +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 DVR SNAT mapping
Revision ID: 41662e32bce2
Revises: 4dbe243cd84d
Create Date: 2014-12-22 16:48:56.922833
"""
# revision identifiers, used by Alembic.
revision = '41662e32bce2'
down_revision = '4dbe243cd84d'
from alembic import op
from sqlalchemy.engine import reflection
from neutron.db import migration
TABLE_NAME = 'csnat_l3_agent_bindings'
def upgrade():
inspector = reflection.Inspector.from_engine(op.get_bind())
prev_pk_const = inspector.get_pk_constraint(TABLE_NAME)
prev_pk_name = prev_pk_const.get('name')
with migration.remove_fks_from_table(TABLE_NAME):
op.drop_constraint(constraint_name=prev_pk_name,
table_name=TABLE_NAME,
type_='primary')
op.create_primary_key(constraint_name=None,
table_name=TABLE_NAME,
columns=['router_id', 'l3_agent_id'])

View File

@ -1,34 +0,0 @@
# 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
# 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 mtu attributes to network
Revision ID: 43763a9618fd
Revises: 16cdf118d31d
Create Date: 2015-02-05 17:44:14.161377
"""
# revision identifiers, used by Alembic.
revision = '43763a9618fd'
down_revision = '16cdf118d31d'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('networks', sa.Column('mtu', sa.Integer(),
nullable=True))

View File

@ -1,47 +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_uniqueconstraint_ipavailability_ranges
Revision ID: 44621190bc02
Revises: juno
Create Date: 2014-09-23 15:14:15.051921
"""
# revision identifiers, used by Alembic.
revision = '44621190bc02'
down_revision = 'juno'
from alembic import op
TABLE_NAME = 'ipavailabilityranges'
UC_1_NAME = 'uniq_ipavailabilityranges0first_ip0allocation_pool_id'
UC_2_NAME = 'uniq_ipavailabilityranges0last_ip0allocation_pool_id'
def upgrade():
op.create_unique_constraint(
constraint_name=UC_1_NAME,
table_name=TABLE_NAME,
columns=['first_ip', 'allocation_pool_id']
)
op.create_unique_constraint(
constraint_name=UC_2_NAME,
table_name=TABLE_NAME,
columns=['last_ip', 'allocation_pool_id']
)

View File

@ -1,57 +0,0 @@
# 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
# 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.
#
"""Initial operations for subnetpools
Revision ID: 51c54792158e
Revises: 341ee8a4ccb5
Create Date: 2015-01-27 13:07:50.713838
"""
# revision identifiers, used by Alembic.
revision = '51c54792158e'
down_revision = '1955efc66455'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('subnetpools',
sa.Column('tenant_id',
sa.String(length=255),
nullable=True,
index=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('ip_version', sa.Integer(), nullable=False),
sa.Column('default_prefixlen',
sa.Integer(),
nullable=False),
sa.Column('min_prefixlen', sa.Integer(), nullable=False),
sa.Column('max_prefixlen', sa.Integer(), nullable=False),
sa.Column('shared', sa.Boolean(), nullable=False),
sa.Column('allow_overlap', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id'))
op.create_table('subnetpoolprefixes',
sa.Column('cidr', sa.String(length=64), nullable=False),
sa.Column('subnetpool_id',
sa.String(length=36),
nullable=False),
sa.ForeignKeyConstraint(['subnetpool_id'],
['subnetpools.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('cidr', 'subnetpool_id'))

View File

@ -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.
#
"""scrap_nsx_adv_svcs_models
Revision ID: 57086602ca0a
Revises: 28c0ffb8ebbd
Create Date: 2014-12-17 22:33:30.465392
"""
# revision identifiers, used by Alembic.
revision = '57086602ca0a'
down_revision = '28c0ffb8ebbd'
from alembic import op
def upgrade():
op.drop_table('vcns_edge_pool_bindings')
op.drop_table('vcns_firewall_rule_bindings')
op.drop_table('vcns_edge_monitor_bindings')
op.drop_table('vcns_edge_vip_bindings')
op.drop_table(u'routerservicetypebindings')
op.drop_table(u'servicerouterbindings')

View File

@ -1,53 +0,0 @@
# 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
# 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_kilo_migrate
Revision ID: 57dd745253a6
Revises: 2b801560a332
Create Date: 2015-02-12 18:32:27.343786
"""
# revision identifiers, used by Alembic.
revision = '57dd745253a6'
down_revision = '2b801560a332'
from alembic import op
import sqlalchemy as sa
CONSTRAINT_NAME_NR = 'uniq_nuage_net_partition_router_mapping0nuage_router_id'
CONSTRAINT_NAME_NS = 'uniq_nuage_subnet_l2dom_mapping0nuage_subnet_id'
def upgrade():
op.add_column('nuage_net_partition_router_mapping',
sa.Column('nuage_rtr_rd', sa.String(length=36), nullable=True))
op.add_column('nuage_net_partition_router_mapping',
sa.Column('nuage_rtr_rt', sa.String(length=36), nullable=True))
op.add_column('nuage_net_partitions',
sa.Column('isolated_zone', sa.String(length=64), nullable=True))
op.add_column('nuage_net_partitions',
sa.Column('shared_zone', sa.String(length=64), nullable=True))
op.add_column('nuage_subnet_l2dom_mapping',
sa.Column('nuage_managed_subnet', sa.Boolean(), nullable=True))
op.create_unique_constraint(
constraint_name=CONSTRAINT_NAME_NR,
table_name='nuage_net_partition_router_mapping',
columns=['nuage_router_id'])
op.create_unique_constraint(
constraint_name=CONSTRAINT_NAME_NS,
table_name='nuage_subnet_l2dom_mapping',
columns=['nuage_subnet_id'])

View File

@ -1,121 +0,0 @@
# Copyright 2015 Cisco Systems, 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.
#
"""Cisco N1kv ML2 driver tables
Revision ID: 589f9237ca0e
Revises: 51c54792158e
Create Date: 2014-08-13 13:31:43.537460
"""
# revision identifiers, used by Alembic.
revision = '589f9237ca0e'
down_revision = '51c54792158e'
from alembic import op
import sqlalchemy as sa
network_profile_type = sa.Enum('vlan', 'vxlan',
name='network_profile_type')
def upgrade():
op.create_table(
'cisco_ml2_n1kv_policy_profiles',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('vsm_ip', sa.String(length=16), nullable=False),
sa.PrimaryKeyConstraint('id', 'vsm_ip'),
)
op.create_table(
'cisco_ml2_n1kv_network_profiles',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('segment_type', network_profile_type, nullable=False),
sa.Column('segment_range', sa.String(length=255), nullable=True),
sa.Column('multicast_ip_index', sa.Integer(), nullable=True),
sa.Column('multicast_ip_range', sa.String(length=255), nullable=True),
sa.Column('sub_type', sa.String(length=255), nullable=True),
sa.Column('physical_network', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_table(
'cisco_ml2_n1kv_port_bindings',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'),
)
op.create_table(
'cisco_ml2_n1kv_network_bindings',
sa.Column('network_id', sa.String(length=36), nullable=False),
sa.Column('network_type', sa.String(length=32), nullable=False),
sa.Column('segmentation_id', sa.Integer(), autoincrement=False),
sa.Column('profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['profile_id'],
['cisco_ml2_n1kv_network_profiles.id']),
sa.PrimaryKeyConstraint('network_id')
)
op.create_table(
'cisco_ml2_n1kv_vxlan_allocations',
sa.Column('vxlan_id', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('allocated', sa.Boolean(), nullable=False),
sa.Column('network_profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['network_profile_id'],
['cisco_ml2_n1kv_network_profiles.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('vxlan_id')
)
op.create_table(
'cisco_ml2_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.Column('network_profile_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['network_profile_id'],
['cisco_ml2_n1kv_network_profiles.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('physical_network', 'vlan_id')
)
# Bugfix for 1463301: PostgreSQL creates type when Enum assigned to column,
# but type profile_type was already created in cisco_init_opts, so it needs
# to be reused. MySQL do not create type for Enums.
if op.get_context().dialect.name == 'postgresql':
profile_type = sa.dialects.postgresql.ENUM('network', 'policy',
name='profile_type',
create_type=False)
else:
profile_type = sa.Enum('network', 'policy', name='profile_type')
op.create_table(
'cisco_ml2_n1kv_profile_bindings',
sa.Column('profile_type', profile_type, nullable=True),
sa.Column('tenant_id', sa.String(length=36), nullable=False,
server_default='tenant_id_not_set'),
sa.Column('profile_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('tenant_id', 'profile_id')
)

View File

@ -1,34 +0,0 @@
# 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
# 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 vlan transparent property to network
Revision ID: bebba223288
Revises: 43763a9618fd
Create Date: 2015-02-04 18:07:29.670554
"""
# revision identifiers, used by Alembic.
revision = 'bebba223288'
down_revision = '43763a9618fd'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('networks', sa.Column('vlan_transparent', sa.Boolean(),
nullable=True))

View File

@ -1,46 +0,0 @@
# 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
# 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.
#
"""Cascade Floating IP Floating Port deletion
Revision ID: f15b1fb526dd
Revises: 57dd745253a6
Create Date: 2014-08-24 21:56:36.422885
"""
# revision identifiers, used by Alembic.
revision = 'f15b1fb526dd'
down_revision = '57dd745253a6'
from alembic import op
from sqlalchemy.engine import reflection
def _drop_constraint():
inspector = reflection.Inspector.from_engine(op.get_bind())
fk_name = [fk['name'] for fk in
inspector.get_foreign_keys('floatingips')
if 'floating_port_id' in fk['constrained_columns']]
op.drop_constraint(fk_name[0], 'floatingips', 'foreignkey')
def upgrade():
_drop_constraint()
op.create_foreign_key(
constraint_name=None,
source_table='floatingips', referent_table='ports',
local_cols=['floating_port_id'], remote_cols=['id'], ondelete='CASCADE'
)

View File

@ -13,15 +13,15 @@
# under the License.
#
"""juno_initial
"""kilo_initial
Revision ID: juno
Revision ID: kilo
Revises: None
"""
# revision identifiers, used by Alembic.
revision = 'juno'
revision = 'kilo'
down_revision = None
@ -36,14 +36,13 @@ from neutron.db.migration.alembic_migrations import lb_init_ops
from neutron.db.migration.alembic_migrations import loadbalancer_init_ops
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 nsxv_initial_opts
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
from neutron.db.migration.alembic_migrations import portsec_init_ops
from neutron.db.migration.alembic_migrations import ryu_init_ops
from neutron.db.migration.alembic_migrations import secgroup_init_ops
from neutron.db.migration.alembic_migrations import vmware_init_ops
from neutron.db.migration.alembic_migrations import vpn_init_ops
@ -66,9 +65,8 @@ def upgrade():
metering_init_ops.upgrade()
brocade_init_ops.upgrade()
cisco_init_ops.upgrade()
mlnx_init_ops.upgrade()
nec_init_ops.upgrade()
other_plugins_init_ops.upgrade()
ryu_init_ops.upgrade()
vmware_init_ops.upgrade()
nuage_init_opts.upgrade()
nsxv_initial_opts.upgrade()

View File

@ -1,29 +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.
#
"""kilo
Revision ID: kilo
Revises: 20c469a5f920
Create Date: 2015-04-16 00:00:00.000000
"""
# revision identifiers, used by Alembic.
revision = 'kilo'
down_revision = '20c469a5f920'
def upgrade():
"""A no-op migration for marking the Kilo release."""
pass

View File

@ -55,41 +55,6 @@ def upgrade():
sa.Column('lswitch_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('router_id'))
op.create_table(
'vcns_edge_pool_bindings',
sa.Column('pool_id', sa.String(length=36), nullable=False),
sa.Column('edge_id', sa.String(length=36), nullable=False),
sa.Column('pool_vseid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('pool_id', 'edge_id'))
op.create_table(
'vcns_edge_monitor_bindings',
sa.Column('monitor_id', sa.String(length=36), nullable=False),
sa.Column('edge_id', sa.String(length=36), nullable=False),
sa.Column('monitor_vseid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['monitor_id'], ['healthmonitors.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('monitor_id', 'edge_id'))
op.create_table(
'vcns_firewall_rule_bindings',
sa.Column('rule_id', sa.String(length=36), nullable=False),
sa.Column('edge_id', sa.String(length=36), nullable=False),
sa.Column('rule_vseid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['rule_id'], ['firewall_rules.id'], ),
sa.PrimaryKeyConstraint('rule_id', 'edge_id'))
op.create_table(
'vcns_edge_vip_bindings',
sa.Column('vip_id', sa.String(length=36), nullable=False),
sa.Column('edge_id', sa.String(length=36), nullable=True),
sa.Column('vip_vseid', sa.String(length=36), nullable=True),
sa.Column('app_profileid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['vip_id'], ['vips.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('vip_id'))
op.create_table(
'networkgateways',
sa.Column('id', sa.String(length=36), nullable=False),
@ -100,7 +65,8 @@ def upgrade():
op.create_table(
'networkconnections',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=True),
sa.Column('network_gateway_id', sa.String(length=36), nullable=True),
sa.Column('network_id', sa.String(length=36), nullable=True),
sa.Column('segmentation_type', l2gw_segmentation_type, nullable=True),
@ -117,7 +83,8 @@ def upgrade():
op.create_table(
'qosqueues',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=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,
@ -206,10 +173,6 @@ def upgrade():
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',
@ -218,10 +181,7 @@ def upgrade():
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),
@ -233,7 +193,8 @@ def upgrade():
op.create_table(
'networkgatewaydevices',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=255), nullable=True,
index=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),

View File

@ -25,7 +25,6 @@ import sqlalchemy
from sqlalchemy import event
import sqlalchemy.types as types
from neutron.api.v2 import attributes as attr
import neutron.db.migration as migration_help
from neutron.db.migration.alembic_migrations import external
from neutron.db.migration import cli as migration
@ -291,35 +290,6 @@ class TestModelsMigrationsPsql(_TestModelsMigrations,
pass
class TestSanityCheck(test_base.DbTestCase):
def setUp(self):
super(TestSanityCheck, self).setUp()
self.alembic_config = migration.get_neutron_config()
self.alembic_config.neutron_config = cfg.CONF
def test_check_sanity_14be42f3d0a5(self):
SecurityGroup = sqlalchemy.Table(
'securitygroups', sqlalchemy.MetaData(),
sqlalchemy.Column('id', sqlalchemy.String(length=36),
nullable=False),
sqlalchemy.Column('name', sqlalchemy.String(attr.NAME_MAX_LEN)),
sqlalchemy.Column('tenant_id',
sqlalchemy.String(attr.TENANT_ID_MAX_LEN)))
with self.engine.connect() as conn:
SecurityGroup.create(conn)
conn.execute(SecurityGroup.insert(), [
{'id': '123d4s', 'tenant_id': 'sssda1', 'name': 'default'},
{'id': '123d4', 'tenant_id': 'sssda1', 'name': 'default'}
])
script_dir = alembic_script.ScriptDirectory.from_config(
self.alembic_config)
script = script_dir.get_revision("14be42f3d0a5").module
self.assertRaises(script.DuplicateSecurityGroupsNamedDefault,
script.check_sanity, conn)
class TestWalkMigrations(test_base.DbTestCase):
def setUp(self):