本文整理汇总了Python中neutron.db.l3_dvr_db.is_distributed_router函数的典型用法代码示例。如果您正苦于以下问题:Python is_distributed_router函数的具体用法?Python is_distributed_router怎么用?Python is_distributed_router使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_distributed_router函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_router
def create_router(self, context, router):
is_ha = self._is_ha(router['router'])
if is_ha and l3_dvr_db.is_distributed_router(router['router']):
raise l3_ha.DistributedHARouterNotSupported()
router['router']['ha'] = is_ha
router_dict = super(L3_HA_NAT_db_mixin,
self).create_router(context, router)
if is_ha:
try:
router_db = self._get_router(context, router_dict['id'])
ha_network = self.get_ha_network(context,
router_db.tenant_id)
if not ha_network:
ha_network = self._create_ha_network(context,
router_db.tenant_id)
self._set_vr_id(context, router_db, ha_network)
self._create_ha_interfaces(context, router_db, ha_network)
self._notify_ha_interfaces_updated(context, router_db.id)
except Exception:
with excutils.save_and_reraise_exception():
self.delete_router(context, router_dict['id'])
router_dict['ha_vr_id'] = router_db.extra_attributes.ha_vr_id
return router_dict
示例2: _create_router_db
def _create_router_db(self, context, router, tenant_id):
router['ha'] = self._is_ha(router)
if router['ha'] and l3_dvr_db.is_distributed_router(router):
raise l3_ha.DistributedHARouterNotSupported()
with context.session.begin(subtransactions=True):
router_db = super(L3_HA_NAT_db_mixin, self)._create_router_db(
context, router, tenant_id)
if router['ha']:
try:
ha_network = self.get_ha_network(context,
router_db.tenant_id)
if not ha_network:
ha_network = self._create_ha_network(context,
router_db.tenant_id)
self._set_vr_id(context, router_db, ha_network)
self._create_ha_interfaces(context, router_db, ha_network)
self._notify_ha_interfaces_updated(context, router_db.id)
except Exception:
with excutils.save_and_reraise_exception():
self.delete_router(context, router_db.id)
return router_db
示例3: create_router
def create_router(self, context, router):
is_ha = self._is_ha(router['router'])
if is_ha and l3_dvr_db.is_distributed_router(router['router']):
raise l3_ha.DistributedHARouterNotSupported()
router['router']['ha'] = is_ha
router_dict = super(L3_HA_NAT_db_mixin,
self).create_router(context, router)
if is_ha:
if cfg.CONF.mulity_ha_network_one_tenant:
router_db = self._get_router(context, router_dict['id'])
ha_network_list = self.get_ha_network_list(context, router_db.tenant_id)
if not ha_network_list:
ha_network_list = [self._create_ha_network(context,
router_db.tenant_id)]
def get_vr_id():
flag = 1
for ha_network in ha_network_list:
try:
self._set_vr_id(context, router_db, ha_network)
flag = 0
LOG.debug("get the vr_id from ha network %s" %ha_network.network['id'])
break
except l3_ha.NoVRIDAvailable:
LOG.debug("the ha network %s vr_id is over " %ha_network.network['id'])
if flag:
LOG.debug("create new ha network")
ha_network = self._create_ha_network(context,
router_db.tenant_id)
self._set_vr_id(context, router_db, ha_network)
self._create_router_ha_network_info(context, router_db.id, ha_network.network['id'])
self._create_ha_interfaces(context, router_db, ha_network)
self._notify_ha_interfaces_updated(context, router_db.id)
router_dict['ha_vr_id'] = router_db.extra_attributes.ha_vr_id
try:
get_vr_id()
except Exception:
with excutils.save_and_reraise_exception():
self.delete_router(context, router_dict['id'])
else:
try:
router_db = self._get_router(context, router_dict['id'])
ha_network = self.get_ha_network(context,
router_db.tenant_id)
if not ha_network:
ha_network = self._create_ha_network(context,
router_db.tenant_id)
self._set_vr_id(context, router_db, ha_network)
self._create_ha_interfaces(context, router_db, ha_network)
self._notify_ha_interfaces_updated(context, router_db.id)
except Exception:
with excutils.save_and_reraise_exception():
self.delete_router(context, router_dict['id'])
router_dict['ha_vr_id'] = router_db.extra_attributes.ha_vr_id
return router_dict
示例4: _get_device_owner
def _get_device_owner(self, context, router=None):
"""Get device_owner for the specified router."""
router_is_uuid = isinstance(router, six.string_types)
if router_is_uuid:
router = self._get_router(context, router)
if is_ha_router(router) and not is_distributed_router(router):
return constants.DEVICE_OWNER_HA_REPLICATED_INT
return super(L3_HA_NAT_db_mixin,
self)._get_device_owner(context, router)
示例5: _should_notify_on_fip_update
def _should_notify_on_fip_update():
if not fip:
return False
for info in removed_routers:
if info['router_id'] == fip['router_id']:
return False
try:
router = l3plugin._get_router(context, fip['router_id'])
except l3_exc.RouterNotFound:
return False
return l3_dvr_db.is_distributed_router(router)
示例6: _make_router_dict
def _make_router_dict(self, router):
distributed = l3_dvr_db.is_distributed_router(router)
res = {'id': router['id'],
'name': router['name'],
'tenant_id': router['tenant_id'],
'admin_state_up': router['admin_state_up'],
'status': router['status'],
'gw_port_id': router['gw_port_id'],
'distributed': distributed,
constants.METERING_LABEL_KEY: []}
return res
示例7: _test__is_distributed_router
def _test__is_distributed_router(self, router, expected):
result = l3_dvr_db.is_distributed_router(router)
self.assertEqual(expected, result)