¡@

Home 

OpenStack Study: common_ext_ops.py

OpenStack Index

**** CubicPower OpenStack Study ****

def upgrade_l3():

    op.create_table(

        'routers',

        sa.Column('tenant_id', sa.String(length=255), nullable=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('gw_port_id', sa.String(length=36), nullable=True),

        sa.ForeignKeyConstraint(['gw_port_id'], ['ports.id'], ),

        sa.PrimaryKeyConstraint('id')

    )

    op.create_table(

        'externalnetworks',

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

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

                                ondelete='CASCADE'),

        sa.PrimaryKeyConstraint('network_id')

    )

    op.create_table(

        'floatingips',

        sa.Column('tenant_id', sa.String(length=255), nullable=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),

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

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

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

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

        sa.ForeignKeyConstraint(['fixed_port_id'], ['ports.id'], ),

        sa.ForeignKeyConstraint(['floating_port_id'], ['ports.id'], ),

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

        sa.PrimaryKeyConstraint('id')

    )

**** CubicPower OpenStack Study ****

def upgrade_quota(options=None):

    if not (options or {}).get('folsom_quota_db_enabled'):

        return

    op.create_table(

        'quotas',

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

        sa.Column('tenant_id', sa.String(255), index=True),

        sa.Column('resource', sa.String(255)),

        sa.Column('limit', sa.Integer()),

        sa.PrimaryKeyConstraint('id')

    )

**** CubicPower OpenStack Study ****

def downgrade_l3():

    for table in ('floatingips', 'routers', 'externalnetworks'):

        op.drop_table(table)

**** CubicPower OpenStack Study ****

def downgrade_quota(options=None):

    if (options or {}).get('folsom_quota_db_enabled'):

        op.drop_table('quotas')