¡@

Home 

OpenStack Study: 569e98a8132b_metering.py

OpenStack Index

**** CubicPower OpenStack Study ****

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

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.drop_table('meteringlabelrules')

    op.drop_table('meteringlabels')

**** CubicPower OpenStack Study ****

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

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.create_table('meteringlabels',

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

                              nullable=True),

                    sa.PrimaryKeyConstraint('id'))

    op.create_table('meteringlabelrules',

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

                    sa.Column('direction',

                              sa.Enum('ingress', 'egress',

                                      name='meteringlabels_direction'),

                              nullable=True),

                    sa.Column('remote_ip_prefix', sa.String(length=64),

                              nullable=True),

                    sa.Column('metering_label_id', sa.String(length=36),

                              nullable=False),

                    sa.Column('excluded', sa.Boolean(),

                              autoincrement=False, nullable=True),

                    sa.ForeignKeyConstraint(['metering_label_id'],

                                            ['meteringlabels.id'],

                                            name='meteringlabelrules_ibfk_1'),

                    sa.PrimaryKeyConstraint('id'))