¡@

Home 

OpenStack Study: 5ac71e65402c_ml2_initial.py

OpenStack Index

**** CubicPower OpenStack Study ****

def upgrade(active_plugins=None, options=None):

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    ### commands auto generated by Alembic - please adjust! ###

    op.create_table(

        'ml2_network_segments',

        sa.Column('id', sa.String(length=36), nullable=False),

        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('id')

    )

    op.create_table(

        'ml2_vlan_allocations',

        sa.Column('physical_network', sa.String(length=64), nullable=False),

        sa.Column('vlan_id', sa.Integer(), autoincrement=False,

                  nullable=False),

        sa.Column('allocated', sa.Boolean(), autoincrement=False,

                  nullable=False),

        sa.PrimaryKeyConstraint('physical_network', 'vlan_id')

    )

    op.create_table(

        'ml2_flat_allocations',

        sa.Column('physical_network', sa.String(length=64), nullable=False),

        sa.PrimaryKeyConstraint('physical_network')

    )

    ### end Alembic commands ###

**** CubicPower OpenStack Study ****

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('ml2_network_segments')

    op.drop_table('ml2_flat_allocations')

    op.drop_table('ml2_vlan_allocations')

    ### end Alembic commands ###