¡@

Home 

OpenStack Study: 32a65f71af51_ml2_portbinding.py

OpenStack Index

**** CubicPower OpenStack Study ****

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

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.create_table(

        'ml2_port_bindings',

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

        sa.Column('host', sa.String(length=255), nullable=False),

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

        sa.Column('cap_port_filter', sa.Boolean(), nullable=False),

        sa.Column('driver', sa.String(length=64), nullable=True),

        sa.Column('segment', sa.String(length=36), nullable=True),

        sa.ForeignKeyConstraint(['port_id'], ['ports.id'],

                                ondelete='CASCADE'),

        sa.ForeignKeyConstraint(['segment'], ['ml2_network_segments.id'],

                                ondelete='SET NULL'),

        sa.PrimaryKeyConstraint('port_id')

    )

    # Note that 176a85fc7d79_add_portbindings_db.py was never enabled

    # for ml2, so there is no need to drop the portbindingports table

    # that is no longer used.

**** CubicPower OpenStack Study ****

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

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.drop_table('ml2_port_bindings')