本文整理汇总了Python中neutron.db.migration.should_run函数的典型用法代码示例。如果您正苦于以下问题:Python should_run函数的具体用法?Python should_run怎么用?Python should_run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了should_run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: upgrade
def upgrade(active_plugins=None, options=None):
# general model
upgrade_base()
if migration.should_run(active_plugins, L3_CAPABLE):
common_ext_ops.upgrade_l3()
if migration.should_run(active_plugins, FOLSOM_QUOTA):
common_ext_ops.upgrade_quota()
if PLUGINS['lbr'] in active_plugins:
upgrade_linuxbridge()
elif PLUGINS['ovs'] in active_plugins:
upgrade_ovs()
elif PLUGINS['cisco'] in active_plugins:
upgrade_cisco()
# Cisco plugin imports OVS models too
upgrade_ovs()
elif PLUGINS['meta'] in active_plugins:
upgrade_meta()
elif PLUGINS['nec'] in active_plugins:
upgrade_nec()
elif PLUGINS['ryu'] in active_plugins:
upgrade_ryu()
elif PLUGINS['brocade'] in active_plugins:
upgrade_brocade()
# Brocade plugin imports linux bridge models too
upgrade_linuxbridge()
开发者ID:AsherBond,项目名称:quantum,代码行数:28,代码来源:folsom_initial.py
示例2: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table(
'vcns_edge_pool_bindings',
sa.Column('pool_id', sa.String(length=36), nullable=False),
sa.Column('edge_id', sa.String(length=36), nullable=False),
sa.Column('pool_vseid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('pool_id', 'edge_id')
)
op.create_table(
'vcns_edge_monitor_bindings',
sa.Column('monitor_id', sa.String(length=36), nullable=False),
sa.Column('edge_id', sa.String(length=36), nullable=False),
sa.Column('monitor_vseid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['monitor_id'], ['healthmonitors.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('monitor_id', 'edge_id')
)
op.create_table(
'vcns_edge_vip_bindings',
sa.Column('vip_id', sa.String(length=36), nullable=False),
sa.Column('edge_id', sa.String(length=36), nullable=True),
sa.Column('vip_vseid', sa.String(length=36), nullable=True),
sa.Column('app_profileid', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['vip_id'], ['vips.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('vip_id')
)
开发者ID:AsherBond,项目名称:quantum,代码行数:32,代码来源:3d6fae8b70b0_nvp_lbaas_plugin.py
示例3: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table(
'dvr_host_macs',
sa.Column('host', sa.String(length=255), nullable=False),
sa.Column('mac_address', sa.String(length=32),
nullable=False, unique=True),
sa.PrimaryKeyConstraint('host')
)
op.create_table(
'ml2_dvr_port_bindings',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('host', sa.String(length=255), nullable=False),
sa.Column('router_id', sa.String(length=36), nullable=True),
sa.Column('vif_type', sa.String(length=64), nullable=False),
sa.Column('vif_details', sa.String(length=4095),
nullable=False, server_default=''),
sa.Column('vnic_type', sa.String(length=64),
nullable=False, server_default='normal'),
sa.Column('profile', sa.String(length=4095),
nullable=False, server_default=''),
sa.Column('cap_port_filter', sa.Boolean(), nullable=False),
sa.Column('driver', sa.String(length=64), nullable=True),
sa.Column('segment', sa.String(length=36), nullable=True),
sa.Column(u'status', sa.String(16), nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['segment'], ['ml2_network_segments.id'],
ondelete='SET NULL'),
sa.PrimaryKeyConstraint('port_id', 'host')
)
开发者ID:AsherBond,项目名称:quantum,代码行数:33,代码来源:2026156eab2f_l2_dvr_models.py
示例4: downgrade
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table(
'servicetypes',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('tenant_id', sa.String(length=255)),
sa.Column('name', sa.String(255)),
sa.Column('description', sa.String(255)),
sa.Column('default', sa.Boolean(), nullable=False, default=False),
sa.Column('num_instances', sa.Integer, default=0),
sa.PrimaryKeyConstraint('id')
)
op.create_table(
'servicedefinitions',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('service_class', sa.String(255)),
sa.Column('plugin', sa.String(255)),
sa.Column('driver', sa.String(255)),
sa.Column('service_type_id', sa.String(36),
sa.ForeignKey('servicetypes.id',
ondelete='CASCADE')),
sa.PrimaryKeyConstraint('id', 'service_class')
)
op.drop_table('providerresourceassociations')
开发者ID:AsherBond,项目名称:quantum,代码行数:25,代码来源:557edfc53098_new_service_types.py
示例5: downgrade
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('networkconnections')
op.drop_table('networkgatewaydevices')
op.drop_table('networkgateways')
开发者ID:50infivedays,项目名称:neutron,代码行数:7,代码来源:363468ac592c_nvp_network_gw.py
示例6: upgrade
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')
)
开发者ID:ArifovicH,项目名称:neutron,代码行数:26,代码来源:4692d074d587_agent_scheduler.py
示例7: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table(
'arista_provisioned_nets',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('network_id', sa.String(length=36), nullable=True),
sa.Column('segmentation_id', sa.Integer(),
autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table(
'arista_provisioned_vms',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('vm_id', sa.String(length=36), nullable=True),
sa.Column('host_id', sa.String(length=255), nullable=True),
sa.Column('port_id', sa.String(length=36), nullable=True),
sa.Column('network_id', sa.String(length=36), nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table(
'arista_provisioned_tenants',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
sa.Column('id', sa.String(length=36), nullable=False),
sa.PrimaryKeyConstraint('id'))
开发者ID:CampHarmony,项目名称:neutron,代码行数:28,代码来源:14f24494ca31_arista_ml2.py
示例8: 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')
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:7,代码来源:1149d7de0cfa_port_security.py
示例9: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table(
'nvp_multi_provider_networks',
sa.Column('network_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'),
mysql_engine='InnoDB'
)
op.create_table('rename_nvp_network_bindings',
sa.Column('network_id', sa.String(length=36),
primary_key=True),
sa.Column('binding_type',
sa.Enum(
'flat', 'vlan', 'stt', 'gre', 'l3_ext',
name=(
'nvp_network_bindings_binding_type')),
nullable=False, primary_key=True),
sa.Column('phy_uuid', sa.String(36), primary_key=True,
nullable=True),
sa.Column('vlan_id', sa.Integer, primary_key=True,
nullable=True, autoincrement=False))
# copy data from nvp_network_bindings into rename_nvp_network_bindings
op.execute("INSERT INTO rename_nvp_network_bindings SELECT network_id, "
"binding_type, phy_uuid, vlan_id from nvp_network_bindings")
op.drop_table('nvp_network_bindings')
op.rename_table('rename_nvp_network_bindings', 'nvp_network_bindings')
开发者ID:50infivedays,项目名称:neutron,代码行数:31,代码来源:3c6e57a23db4_add_multiprovider.py
示例10: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.add_column('floatingips',
sa.Column('rate_limit', sa.Integer(),
nullable=True, default=1024))
开发者ID:CingHu,项目名称:neutron-ustack,代码行数:7,代码来源:105e42d08d72_floatingip_rate_limit.py
示例11: downgrade
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
if op.get_bind().engine.name == 'ibm_db_sa':
# Note(xuhanp): DB2 doesn't allow nullable=False Column with
# "DEFAULT" clause not specified. So server_default is used.
# Using sa.text will result "DEFAULT 0" for cap_port_filter.
op.add_column('ml2_port_bindings',
sa.Column('cap_port_filter', sa.Boolean(),
nullable=False,
server_default=sa.text("0")))
op.execute(
"UPDATE ml2_port_bindings SET"
" cap_port_filter = 1"
" WHERE vif_details LIKE '%\"port_filter\": true%'")
else:
op.add_column('ml2_port_bindings',
sa.Column('cap_port_filter', sa.Boolean(),
nullable=False,
server_default=sa.text("false")))
op.execute(
"UPDATE ml2_port_bindings SET"
" cap_port_filter = true"
" WHERE vif_details LIKE '%\"port_filter\": true%'")
op.drop_column('ml2_port_bindings', 'vif_details')
if op.get_bind().engine.name == 'ibm_db_sa':
op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
开发者ID:AsherBond,项目名称:quantum,代码行数:28,代码来源:50d5ba354c23_ml2_binding_vif_details.py
示例12: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.add_column('ml2_port_bindings',
sa.Column('vif_details', sa.String(length=4095),
nullable=False, server_default=''))
if op.get_bind().engine.name == 'ibm_db_sa':
op.execute(
"UPDATE ml2_port_bindings SET"
" vif_details = '{\"port_filter\": true}'"
" WHERE cap_port_filter = 1")
op.execute(
"UPDATE ml2_port_bindings SET"
" vif_details = '{\"port_filter\": false}'"
" WHERE cap_port_filter = 0")
else:
op.execute(
"UPDATE ml2_port_bindings SET"
" vif_details = '{\"port_filter\": true}'"
" WHERE cap_port_filter = true")
op.execute(
"UPDATE ml2_port_bindings SET"
" vif_details = '{\"port_filter\": false}'"
" WHERE cap_port_filter = false")
op.drop_column('ml2_port_bindings', 'cap_port_filter')
if op.get_bind().engine.name == 'ibm_db_sa':
op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
开发者ID:AsherBond,项目名称:quantum,代码行数:28,代码来源:50d5ba354c23_ml2_binding_vif_details.py
示例13: upgrade
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'))
开发者ID:50infivedays,项目名称:neutron,代码行数:29,代码来源:569e98a8132b_metering.py
示例14: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
# Workaround for Alemic bug #89
# https://bitbucket.org/zzzeek/alembic/issue/89
context = op.get_context()
if context.bind.dialect.name == "postgresql":
op.execute(
"CREATE TYPE ipv6_ra_modes AS ENUM ('%s', '%s', '%s')" % ("slaac", "dhcpv6-stateful", "dhcpv6-stateless")
)
op.execute(
"CREATE TYPE ipv6_address_modes AS ENUM ('%s', '%s', '%s')"
% ("slaac", "dhcpv6-stateful", "dhcpv6-stateless")
)
op.add_column(
"subnets",
sa.Column(
"ipv6_ra_mode", sa.Enum("slaac", "dhcpv6-stateful", "dhcpv6-stateless", name="ipv6_ra_modes"), nullable=True
),
)
op.add_column(
"subnets",
sa.Column(
"ipv6_address_mode",
sa.Enum("slaac", "dhcpv6-stateful", "dhcpv6-stateless", name="ipv6_address_modes"),
nullable=True,
),
)
开发者ID:chrisacbr,项目名称:openstack-neutron,代码行数:29,代码来源:2447ad0e9585_add_ipv6_mode_props.py
示例15: downgrade
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
# Delete the multi_provider_network entries from nvp_network_bindings
op.execute("DELETE from nvp_network_bindings WHERE network_id IN "
"(SELECT network_id from nvp_multi_provider_networks)")
# create table with previous contains
op.create_table(
'rename_nvp_network_bindings',
sa.Column('network_id', sa.String(length=36), primary_key=True),
sa.Column('binding_type',
sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
name=('nvp_network_bindings_binding_type')),
nullable=False),
sa.Column('phy_uuid', sa.String(36), nullable=True),
sa.Column('vlan_id', sa.Integer, nullable=True, autoincrement=False))
# copy data from nvp_network_bindings into rename_nvp_network_bindings
op.execute("INSERT INTO rename_nvp_network_bindings SELECT network_id, "
"binding_type, phy_uuid, vlan_id from nvp_network_bindings")
op.drop_table('nvp_network_bindings')
op.rename_table('rename_nvp_network_bindings', 'nvp_network_bindings')
op.drop_table('nvp_multi_provider_networks')
开发者ID:50infivedays,项目名称:neutron,代码行数:26,代码来源:3c6e57a23db4_add_multiprovider.py
示例16: 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")
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:30,代码来源:1149d7de0cfa_port_security.py
示例17: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, 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")
开发者ID:kavonm,项目名称:neutron,代码行数:7,代码来源:128e042a2b68_ext_gw_mode.py
示例18: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table(
'cisco_n1kv_trunk_segments',
sa.Column('trunk_segment_id', sa.String(length=36), nullable=False),
sa.Column('segment_id', sa.String(length=36), nullable=False),
sa.Column('dot1qtag', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['trunk_segment_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('trunk_segment_id', 'segment_id', 'dot1qtag')
)
op.create_table(
'cisco_n1kv_multi_segments',
sa.Column('multi_segment_id', sa.String(length=36), nullable=False),
sa.Column('segment1_id', sa.String(length=36), nullable=False),
sa.Column('segment2_id', sa.String(length=36), nullable=False),
sa.Column('encap_profile_name', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['multi_segment_id'], ['networks.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('multi_segment_id', 'segment1_id',
'segment2_id')
)
migration.alter_enum('cisco_network_profiles', 'segment_type', new_type,
nullable=False)
op.add_column('cisco_network_profiles',
sa.Column('sub_type', sa.String(length=255), nullable=True))
开发者ID:AsherBond,项目名称:quantum,代码行数:28,代码来源:46a0efbd8f0_cisco_n1kv_multisegm.py
示例19: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table(
'nuage_floatingip_pool_mapping',
sa.Column('fip_pool_id', sa.String(length=36), nullable=False),
sa.Column('net_id', sa.String(length=36), nullable=True),
sa.Column('router_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['net_id'], ['networks.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('fip_pool_id'),
)
op.create_table(
'nuage_floatingip_mapping',
sa.Column('fip_id', sa.String(length=36), nullable=False),
sa.Column('router_id', sa.String(length=36), nullable=True),
sa.Column('nuage_fip_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['fip_id'], ['floatingips.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('fip_id'),
)
op.rename_table('net_partitions', 'nuage_net_partitions')
op.rename_table('net_partition_router_mapping',
'nuage_net_partition_router_mapping')
op.rename_table('router_zone_mapping', 'nuage_router_zone_mapping')
op.rename_table('subnet_l2dom_mapping', 'nuage_subnet_l2dom_mapping')
op.rename_table('port_mapping', 'nuage_port_mapping')
op.rename_table('routerroutes_mapping', 'nuage_routerroutes_mapping')
开发者ID:AsherBond,项目名称:quantum,代码行数:31,代码来源:2db5203cb7a9_nuage_floatingip.py
示例20: upgrade
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.add_column('ml2_port_bindings',
sa.Column('profile', sa.String(length=4095),
nullable=False, server_default=''))
开发者ID:50infivedays,项目名称:neutron,代码行数:7,代码来源:157a5d299379_ml2_binding_profile.py
注:本文中的neutron.db.migration.should_run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论