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

Python utils.in_pending_status函数代码示例

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

本文整理汇总了Python中neutron.plugins.common.utils.in_pending_status函数的典型用法代码示例。如果您正苦于以下问题:Python in_pending_status函数的具体用法?Python in_pending_status怎么用?Python in_pending_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了in_pending_status函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: update

    def update(self):
        """Update Status based on vpnservice configuration."""

        # Disable the process if a vpnservice is disabled or it has no
        # enabled IPSec site connections.
        vpnservice_has_active_ipsec_site_conns = any(
            [ipsec_site_conn['admin_state_up']
             for ipsec_site_conn in self.vpnservice['ipsec_site_connections']])
        if (not self.vpnservice['admin_state_up'] or
                not vpnservice_has_active_ipsec_site_conns):
            self.disable()
        else:
            self.enable()

        if plugin_utils.in_pending_status(self.vpnservice['status']):
            self.updated_pending_status = True

        self.vpnservice['status'] = self.status
        for ipsec_site_conn in self.vpnservice['ipsec_site_connections']:
            if plugin_utils.in_pending_status(ipsec_site_conn['status']):
                conn_id = ipsec_site_conn['id']
                conn_status = self.connection_status.get(conn_id)
                if not conn_status:
                    continue
                conn_status['updated_pending_status'] = True
                ipsec_site_conn['status'] = conn_status['status']
开发者ID:wywangsh,项目名称:neutron-vpnaas,代码行数:26,代码来源:ipsec.py


示例2: update_status_by_agent

    def update_status_by_agent(self, context, service_status_info_list):
        """Updating vpnservice and vpnconnection status.

        :param context: context variable
        :param service_status_info_list: list of status
        The structure is
        [{id: vpnservice_id,
          status: ACTIVE|DOWN|ERROR,
          updated_pending_status: True|False
          ipsec_site_connections: {
              ipsec_site_connection_id: {
                  status: ACTIVE|DOWN|ERROR,
                  updated_pending_status: True|False
              }
          }]
        The agent will set updated_pending_status as True,
        when agent update any pending status.
        """
        with context.session.begin(subtransactions=True):
            for vpnservice in service_status_info_list:
                try:
                    vpnservice_db = self._get_vpnservice(context, vpnservice["id"])
                except vpnaas.VPNServiceNotFound:
                    LOG.warn(_("vpnservice %s in db is already deleted"), vpnservice["id"])
                    continue

                if not utils.in_pending_status(vpnservice_db.status) or vpnservice["updated_pending_status"]:
                    vpnservice_db.status = vpnservice["status"]
                for conn_id, conn in vpnservice["ipsec_site_connections"].items():
                    try:
                        conn_db = self._get_ipsec_site_connection(context, conn_id)
                    except vpnaas.IPsecSiteConnectionNotFound:
                        continue
                    if not utils.in_pending_status(conn_db.status) or conn["updated_pending_status"]:
                        conn_db.status = conn["status"]
开发者ID:Taejun,项目名称:neutron,代码行数:35,代码来源:vpn_db.py


示例3: build_report_for_service

    def build_report_for_service(self, vpn_service):
        """Create the report info for a VPN service and its IPSec connections.

        Get the report info for the connections on the service, and include
        it into the report info for the VPN service. If there is no report
        info for the connection, then no change has occurred and no report
        will be generated. If there is only one connection for the service,
        we'll set the service state to match the connection (with ERROR seen
        as DOWN).
        """
        conn_report = self.build_report_for_connections_on(vpn_service)
        if conn_report:
            pending_handled = plugin_utils.in_pending_status(
                vpn_service.last_status)
            if (len(conn_report) == 1 and
                conn_report.values()[0]['status'] != constants.ACTIVE):
                vpn_service.last_status = constants.DOWN
            else:
                vpn_service.last_status = constants.ACTIVE
            LOG.debug(_("Report: Adding info for VPN service %s"),
                      vpn_service.service_id)
            return {u'id': vpn_service.service_id,
                    u'status': vpn_service.last_status,
                    u'updated_pending_status': pending_handled,
                    u'ipsec_site_connections': conn_report}
        else:
            return {}
开发者ID:50infivedays,项目名称:neutron,代码行数:27,代码来源:cisco_ipsec.py


示例4: build_report_based_on_status

 def build_report_based_on_status(self, current_status):
     if current_status != self.last_status:
         pending_handled = plugin_utils.in_pending_status(self.last_status)
         self.last_status = current_status
         return {self.conn_id: {'status': current_status,
                                'updated_pending_status': pending_handled}}
     else:
         return {}
开发者ID:50infivedays,项目名称:neutron,代码行数:8,代码来源:cisco_ipsec.py


示例5: update

    def update(self):
        """Update Status based on vpnservice configuration."""
        if self.vpnservice and not self.vpnservice['admin_state_up']:
            self.disable()
        else:
            self.enable()

        if plugin_utils.in_pending_status(self.vpnservice['status']):
            self.updated_pending_status = True

        self.vpnservice['status'] = self.status
        for ipsec_site_conn in self.vpnservice['ipsec_site_connections']:
            if plugin_utils.in_pending_status(ipsec_site_conn['status']):
                conn_id = ipsec_site_conn['id']
                conn_status = self.connection_status.get(conn_id)
                if not conn_status:
                    continue
                conn_status['updated_pending_status'] = True
                ipsec_site_conn['status'] = conn_status['status']
开发者ID:leesurezen,项目名称:neutron,代码行数:19,代码来源:ipsec.py


示例6: _update_connection_status

    def _update_connection_status(self, context, conn_id, new_status,
                                  updated_pending):
        """Update the connection status, if changed.

        If the connection is not in a pending state, unconditionally update
        the status. Likewise, if in a pending state, and have an indication
        that the status has changed, then update the database.
        """
        try:
            conn_db = self._get_ipsec_site_connection(context, conn_id)
        except vpnaas.IPsecSiteConnectionNotFound:
            return
        if not utils.in_pending_status(conn_db.status) or updated_pending:
            conn_db.status = new_status
开发者ID:Jieming,项目名称:neutron,代码行数:14,代码来源:vpn_db.py


示例7: assert_update_allowed

 def assert_update_allowed(self, obj):
     status = getattr(obj, 'status', None)
     if utils.in_pending_status(status):
         raise vpnaas.VPNStateInvalid(id=id, state=status)
开发者ID:CampHarmony,项目名称:neutron,代码行数:4,代码来源:vpn_db.py


示例8: assert_update_allowed

 def assert_update_allowed(self, obj):
     status = getattr(obj, "status", None)
     _id = getattr(obj, "id", None)
     if utils.in_pending_status(status):
         raise vpnaas.VPNStateInvalidToUpdate(id=_id, state=status)
开发者ID:Taejun,项目名称:neutron,代码行数:5,代码来源:vpn_db.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.parse_network_vlan_ranges函数代码示例发布时间:2022-05-27
下一篇:
Python utils.create_port函数代码示例发布时间: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