¡@

Home 

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

        u'vips',

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

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

        sa.Column(u'name', sa.String(255), nullable=True),

        sa.Column(u'description', sa.String(255), nullable=True),

        sa.Column(u'port_id', sa.String(36), nullable=True),

        sa.Column(u'protocol_port', sa.Integer(), nullable=False),

        sa.Column(u'protocol',

                  sa.Enum("HTTP", "HTTPS", "TCP", name="lb_protocols"),

                  nullable=False),

        sa.Column(u'pool_id', sa.String(36), nullable=False),

        sa.Column(u'status', sa.String(16), nullable=False),

        sa.Column(u'admin_state_up', sa.Boolean(), nullable=False),

        sa.Column(u'connection_limit', sa.Integer(), nullable=True),

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

        sa.UniqueConstraint('pool_id'),

        sa.PrimaryKeyConstraint(u'id')

    )

    op.create_table(

        u'sessionpersistences',

        sa.Column(u'vip_id', sa.String(36), nullable=False),

        sa.Column(u'type',

                  sa.Enum("SOURCE_IP",

                          "HTTP_COOKIE",

                          "APP_COOKIE",

                          name="sesssionpersistences_type"),

                  nullable=False),

        sa.Column(u'cookie_name', sa.String(1024), nullable=True),

        sa.ForeignKeyConstraint(['vip_id'], [u'vips.id'], ),

        sa.PrimaryKeyConstraint(u'vip_id')

    )

    op.create_table(

        u'pools',

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

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

        sa.Column(u'vip_id', sa.String(36), nullable=True),

        sa.Column(u'name', sa.String(255), nullable=True),

        sa.Column(u'description', sa.String(255), nullable=True),

        sa.Column(u'subnet_id', sa.String(36), nullable=False),

        sa.Column(u'protocol',

                  sa.Enum("HTTP", "HTTPS", "TCP", name="lb_protocols"),

                  nullable=False),

        sa.Column(u'lb_method',

                  sa.Enum("ROUND_ROBIN",

                          "LEAST_CONNECTIONS",

                          "SOURCE_IP",

                          name="pools_lb_method"),

                  nullable=False),

        sa.Column(u'status', sa.String(16), nullable=False),

        sa.Column(u'admin_state_up', sa.Boolean(), nullable=False),

        sa.ForeignKeyConstraint(['vip_id'], [u'vips.id'], ),

        sa.PrimaryKeyConstraint(u'id')

    )

    op.create_table(

        u'healthmonitors',

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

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

        sa.Column(u'type',

                  sa.Enum("PING",

                          "TCP",

                          "HTTP",

                          "HTTPS",

                          name="healthmontiors_type"),

                  nullable=False),

        sa.Column(u'delay', sa.Integer(), nullable=False),

        sa.Column(u'timeout', sa.Integer(), nullable=False),

        sa.Column(u'max_retries', sa.Integer(), nullable=False),

        sa.Column(u'http_method', sa.String(16), nullable=True),

        sa.Column(u'url_path', sa.String(255), nullable=True),

        sa.Column(u'expected_codes', sa.String(64), nullable=True),

        sa.Column(u'status', sa.String(16), nullable=False),

        sa.Column(u'admin_state_up', sa.Boolean(), nullable=False),

        sa.PrimaryKeyConstraint(u'id')

    )

    op.create_table(

        u'poolmonitorassociations',

        sa.Column(u'pool_id', sa.String(36), nullable=False),

        sa.Column(u'monitor_id', sa.String(36), nullable=False),

        sa.ForeignKeyConstraint(['monitor_id'], [u'healthmonitors.id'], ),

        sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'], ),

        sa.PrimaryKeyConstraint(u'pool_id', u'monitor_id')

    )

    op.create_table(

        u'members',

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

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

        sa.Column(u'pool_id', sa.String(36), nullable=False),

        sa.Column(u'address', sa.String(64), nullable=False),

        sa.Column(u'protocol_port', sa.Integer(), nullable=False),

        sa.Column(u'weight', sa.Integer(), nullable=False),

        sa.Column(u'status', sa.String(16), nullable=False),

        sa.Column(u'admin_state_up', sa.Boolean(), nullable=False),

        sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'], ),

        sa.PrimaryKeyConstraint(u'id')

    )

    op.create_table(

        u'poolstatisticss',

        sa.Column(u'pool_id', sa.String(36), nullable=False),

        sa.Column(u'bytes_in', sa.Integer(), nullable=False),

        sa.Column(u'bytes_out', sa.Integer(), nullable=False),

        sa.Column(u'active_connections', sa.Integer(), nullable=False),

        sa.Column(u'total_connections', sa.Integer(), nullable=False),

        sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'], ),

        sa.PrimaryKeyConstraint(u'pool_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(u'poolstatisticss')

    op.drop_table(u'members')

    op.drop_table(u'poolmonitorassociations')

    op.drop_table(u'healthmonitors')

    op.drop_table(u'pools')

    op.drop_table(u'sessionpersistences')

    op.drop_table(u'vips')