¡@

Home 

OpenStack Study: 3d3cb89d84ee_nsx_switch_mappings.py

OpenStack Index

**** CubicPower OpenStack Study ****

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

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    # Create table for network mappings

    op.create_table(

        'neutron_nsx_network_mappings',

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

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

        sa.ForeignKeyConstraint(['neutron_id'], ['networks.id'],

                                ondelete='CASCADE'),

        # There might be multiple switches for a neutron network

        sa.PrimaryKeyConstraint('neutron_id', 'nsx_id'),

    )

**** CubicPower OpenStack Study ****

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