• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python l3_dvr_db.is_distributed_router函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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
开发者ID:lzxm160,项目名称:neutron,代码行数:27,代码来源:l3_hamode_db.py


示例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
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:26,代码来源:l3_hamode_db.py


示例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
开发者ID:xiongmeng1108,项目名称:gcloud7_neutron-2014.2.2,代码行数:59,代码来源:l3_hamode_db.py


示例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)
开发者ID:mmalchuk,项目名称:openstack-neutron,代码行数:9,代码来源:l3_hamode_db.py


示例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)
开发者ID:cubeek,项目名称:neutron,代码行数:11,代码来源:l3_dvrscheduler_db.py


示例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
开发者ID:igordcard,项目名称:neutron,代码行数:12,代码来源:metering_db.py


示例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)
开发者ID:markmcclain,项目名称:neutron,代码行数:3,代码来源:test_l3_dvr_db.py



注:本文中的neutron.db.l3_dvr_db.is_distributed_router函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python migration.schema_has_column函数代码示例发布时间:2022-05-27
下一篇:
Python common_db_mixin.model_query函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap