¡@

Home 

OpenStack Study: 4692d074d587_agent_scheduler.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(

        'networkdhcpagentbindings',

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

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

        sa.ForeignKeyConstraint(['dhcp_agent_id'], ['agents.id'],

                                ondelete='CASCADE'),

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

                                ondelete='CASCADE'),

        sa.PrimaryKeyConstraint('network_id', 'dhcp_agent_id')

    )

    op.create_table(

        'routerl3agentbindings',

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

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

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

        sa.ForeignKeyConstraint(['l3_agent_id'], ['agents.id'],

                                ondelete='CASCADE'),

        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],

                                ondelete='CASCADE'),

        sa.PrimaryKeyConstraint('id')

    )

    ### 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('routerl3agentbindings')

    op.drop_table('networkdhcpagentbindings')

    ### end Alembic commands ###