本文整理汇总了Python中quantum.db.migration.should_run函数的典型用法代码示例。如果您正苦于以下问题:Python should_run函数的具体用法?Python should_run怎么用?Python should_run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了should_run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.add_column("routers", sa.Column("enable_snat", sa.Boolean(), nullable=False, default=True))
# Set enable_snat to True for existing routers
op.execute("UPDATE routers SET enable_snat=True")
示例2: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
### commands auto generated by Alembic - please adjust! ###
op.create_table(
"qosqueues",
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("default", sa.Boolean(), nullable=True),
sa.Column("min", sa.Integer(), nullable=False),
sa.Column("max", sa.Integer(), nullable=True),
sa.Column("qos_marking", sa.Enum("untrusted", "trusted", name="qosqueues_qos_marking"), nullable=True),
sa.Column("dscp", sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"networkqueuemappings",
sa.Column("network_id", sa.String(length=36), nullable=False),
sa.Column("queue_id", sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(["network_id"], ["networks.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["queue_id"], ["qosqueues.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("network_id"),
)
op.create_table(
"portqueuemappings",
sa.Column("port_id", sa.String(length=36), nullable=False),
sa.Column("queue_id", sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(["port_id"], ["ports.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["queue_id"], ["qosqueues.id"]),
sa.PrimaryKeyConstraint("port_id", "queue_id"),
)
示例3: downgrade
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
### commands auto generated by Alembic - please adjust! ###
op.drop_table('portsecuritybindings')
op.drop_table('networksecuritybindings')
示例4: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.create_table(
'ofctenantmappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
op.create_table(
'ofcnetworkmappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
op.create_table(
'ofcportmappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
op.create_table(
'ofcfiltermappings',
sa.Column('ofc_id', sa.String(length=255), nullable=False),
sa.Column('quantum_id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('quantum_id'),
sa.UniqueConstraint('ofc_id')
)
示例5: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.create_table(
u'servicetypes',
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'default', sa.Boolean(),
autoincrement=False, nullable=False),
sa.Column(u'num_instances', sa.Integer(),
autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint(u'id'))
op.create_table(
u'servicedefinitions',
sa.Column(u'id', sa.String(36), nullable=False),
sa.Column(u'service_class', sa.String(length=255),
nullable=False),
sa.Column(u'plugin', sa.String(255), nullable=True),
sa.Column(u'driver', sa.String(255), nullable=True),
sa.Column(u'service_type_id', sa.String(36),
nullable=False),
sa.ForeignKeyConstraint(['service_type_id'], [u'servicetypes.id'],
name=u'servicedefinitions_ibfk_1'),
sa.PrimaryKeyConstraint(u'id', u'service_class', u'service_type_id'))
示例6: downgrade
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.drop_table('networkconnections')
op.drop_table('networkgatewaydevices')
op.drop_table('networkgateways')
示例7: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, 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')
)
示例8: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
### commands auto generated by Alembic - please adjust! ###
op.create_table('networksecuritybindings',
sa.Column('network_id', sa.String(length=36),
nullable=False),
sa.Column('port_security_enabled', sa.Boolean(),
nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'))
op.create_table('portsecuritybindings',
sa.Column('port_id', sa.String(length=36),
nullable=False),
sa.Column('port_security_enabled', sa.Boolean(),
nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'))
### end Alembic commands ###
# Copy network and port ids over to network|port(securitybindings) table
# and set port_security_enabled to false as ip address pairs were not
# configured in NVP originally.
op.execute("INSERT INTO networksecuritybindings SELECT id as "
"network_id, False as port_security_enabled from networks")
op.execute("INSERT INTO portsecuritybindings SELECT id as port_id, "
"False as port_security_enabled from ports")
示例9: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.create_table(
u'servicetypes',
sa.Column(u'tenant_id', mysql.VARCHAR(length=255), nullable=True),
sa.Column(u'id', mysql.VARCHAR(length=36), nullable=False),
sa.Column(u'name', mysql.VARCHAR(length=255), nullable=True),
sa.Column(u'description', mysql.VARCHAR(length=255), nullable=True),
sa.Column(u'default', mysql.TINYINT(display_width=1),
autoincrement=False, nullable=False),
sa.Column(u'num_instances', mysql.INTEGER(display_width=11),
autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint(u'id'))
op.create_table(
u'servicedefinitions',
sa.Column(u'id', mysql.VARCHAR(length=36), nullable=False),
sa.Column(u'service_class', mysql.VARCHAR(length=255),
nullable=False),
sa.Column(u'plugin', mysql.VARCHAR(length=255), nullable=True),
sa.Column(u'driver', mysql.VARCHAR(length=255), nullable=True),
sa.Column(u'service_type_id', mysql.VARCHAR(length=36),
nullable=False),
sa.ForeignKeyConstraint(['service_type_id'], [u'servicetypes.id'],
name=u'servicedefinitions_ibfk_1'),
sa.PrimaryKeyConstraint(u'id', u'service_class', u'service_type_id'))
示例10: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
### commands auto generated by Alembic - please adjust! ###
op.create_table(
'ml2_network_segments',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('network_id', sa.String(length=36), nullable=False),
sa.Column('network_type', sa.String(length=32), nullable=False),
sa.Column('physical_network', sa.String(length=64), nullable=True),
sa.Column('segmentation_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table(
'ml2_vlan_allocations',
sa.Column('physical_network', sa.String(length=64), nullable=False),
sa.Column('vlan_id', sa.Integer(), autoincrement=False,
nullable=False),
sa.Column('allocated', sa.Boolean(), autoincrement=False,
nullable=False),
sa.PrimaryKeyConstraint('physical_network', 'vlan_id')
)
op.create_table(
'ml2_flat_allocations',
sa.Column('physical_network', sa.String(length=64), nullable=False),
sa.PrimaryKeyConstraint('physical_network')
)
示例11: upgrade
def upgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.drop_table(u'port_bindings')
op.drop_table(u'services_bindings')
op.drop_table(u'portprofiles')
op.drop_table(u'portprofile_bindings')
示例12: downgrade
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.drop_table('ofcfiltermappings')
op.drop_table('ofcportmappings')
op.drop_table('ofcnetworkmappings')
op.drop_table('ofctenantmappings')
示例13: downgrade
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.rename_table(
'subnetroutes',
'routes',
)
op.drop_table('routerroutes')
示例14: downgrade
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.create_table(
'ovs_tunnel_ips',
sa.Column('ip_address', sa.String(length=255), nullable=False),
sa.PrimaryKeyConstraint('ip_address')
)
示例15: downgrade
def downgrade(active_plugin=None, options=None):
if not migration.should_run(active_plugin, migration_for_plugins):
return
op.drop_table(u'poolstatisticss')
op.drop_table(u'members')
op.drop_table(u'healthmonitors')
op.drop_table(u'pools')
op.drop_table(u'sessionpersistences')
op.drop_table(u'poolmonitorassociations')
op.drop_table(u'vips')