当前位置: 首页>>代码示例>>Python>>正文


Python _i18n._LW函数代码示例

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


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

示例1: update_status

 def update_status(self, context, obj_type, obj_id,
                   provisioning_status=None, operating_status=None):
     if not provisioning_status and not operating_status:
         LOG.warning(_LW('update_status for %(obj_type)s %(obj_id)s called '
                         'without specifying provisioning_status or '
                         'operating_status') % {'obj_type': obj_type,
                                                'obj_id': obj_id})
         return
     model_mapping = {
         'loadbalancer': db_models.LoadBalancer,
         'pool': db_models.PoolV2,
         'listener': db_models.Listener,
         'member': db_models.MemberV2,
         'healthmonitor': db_models.HealthMonitorV2
     }
     if obj_type not in model_mapping:
         raise n_exc.Invalid(_('Unknown object type: %s') % obj_type)
     try:
         self.plugin.db.update_status(
             context, model_mapping[obj_type], obj_id,
             provisioning_status=provisioning_status,
             operating_status=operating_status)
     except n_exc.NotFound:
         # update_status may come from agent on an object which was
         # already deleted from db with other request
         LOG.warning(_LW('Cannot update status: %(obj_type)s %(obj_id)s '
                         'not found in the DB, it was probably deleted '
                         'concurrently'),
                     {'obj_type': obj_type, 'obj_id': obj_id})
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:29,代码来源:agent_callbacks.py

示例2: call

 def call(self, action, resource, data, headers, binary=False):
     resp = self._call(action, resource, data, headers, binary)
     if resp[RESP_STATUS] == -1:
         LOG.warning(_LW('vDirect server is not responding (%s).'),
                     self.server)
         return self._recover(action, resource, data, headers, binary)
     elif resp[RESP_STATUS] in (301, 307):
         LOG.warning(_LW('vDirect server is not active (%s).'),
                     self.server)
         return self._recover(action, resource, data, headers, binary)
     else:
         return resp
开发者ID:Stef1010,项目名称:neutron-lbaas,代码行数:12,代码来源:rest_client.py

示例3: get_ready_devices

    def get_ready_devices(self, context, host=None):
        with context.session.begin(subtransactions=True):
            agents = self.plugin.db.get_lbaas_agents(
                context, filters={'host': [host]})
            if not agents:
                return []
            elif len(agents) > 1:
                LOG.warning(_LW('Multiple lbaas agents found on host %s'),
                            host)
            loadbalancers = self.plugin.db.list_loadbalancers_on_lbaas_agent(
                context, agents[0].id)
            loadbalancer_ids = [
                l.id for l in loadbalancers]

            qry = context.session.query(
                loadbalancer_dbv2.models.LoadBalancer.id)
            qry = qry.filter(
                loadbalancer_dbv2.models.LoadBalancer.id.in_(
                    loadbalancer_ids))
            qry = qry.filter(
                loadbalancer_dbv2.models.LoadBalancer.provisioning_status.in_(
                    constants.ACTIVE_PENDING_STATUSES))
            up = True  # makes pep8 and sqlalchemy happy
            qry = qry.filter(
                loadbalancer_dbv2.models.LoadBalancer.admin_state_up == up)
            return [id for id, in qry]
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:26,代码来源:agent_callbacks.py

示例4: _cleanup_namespace

 def _cleanup_namespace(self, loadbalancer_id):
     namespace = get_ns_name(loadbalancer_id)
     ns = ip_lib.IPWrapper(namespace=namespace)
     try:
         for device in ns.get_devices(exclude_loopback=True):
             if ip_lib.device_exists(device.name):
                 self.vif_driver.unplug(device.name, namespace=namespace)
     except RuntimeError as re:
         LOG.warn(_LW('An error happened on namespace cleanup: '
                    '%s') % re.message)
     ns.garbage_collect_namespace()
开发者ID:jlongstaf,项目名称:neutron-lbaas,代码行数:11,代码来源:synchronous_namespace_driver.py

示例5: schedule

    def schedule(self, plugin, context, loadbalancer, device_driver):
        """Schedule the load balancer to an active loadbalancer agent if there
        is no enabled agent hosting it.
        """
        with context.session.begin(subtransactions=True):
            lbaas_agent = plugin.db.get_agent_hosting_loadbalancer(
                context, loadbalancer.id)
            if lbaas_agent:
                LOG.debug('Load balancer %(loadbalancer_id)s '
                          'has already been hosted'
                          ' by lbaas agent %(agent_id)s',
                          {'loadbalancer_id': loadbalancer.id,
                           'agent_id': lbaas_agent['id']})
                return

            active_agents = plugin.db.get_lbaas_agents(context, active=True)
            if not active_agents:
                LOG.warn(
                    _LW('No active lbaas agents for load balancer %s'),
                    loadbalancer.id)
                return

            candidates = plugin.db.get_lbaas_agent_candidates(device_driver,
                                                              active_agents)
            if not candidates:
                LOG.warn(_LW('No lbaas agent supporting device driver %s'),
                         device_driver)
                return

            chosen_agent = random.choice(candidates)
            binding = LoadbalancerAgentBinding()
            binding.agent = chosen_agent
            binding.loadbalancer_id = loadbalancer.id
            context.session.add(binding)
            LOG.debug(
                'Load balancer %(loadbalancer_id)s is scheduled '
                'to lbaas agent %(agent_id)s', {
                    'loadbalancer_id': loadbalancer.id,
                    'agent_id': chosen_agent['id']}
            )
            return chosen_agent
开发者ID:jlongstaf,项目名称:neutron-lbaas,代码行数:41,代码来源:agent_scheduler.py

示例6: _delete_pip_nports

 def _delete_pip_nports(success):
     if success:
         for port in ports:
             try:
                 self.plugin._core_plugin.delete_port(
                     context, port['id'])
                 LOG.debug('pip nport id: %s', port['id'])
             except Exception as exception:
                 # stop exception propagation, nport may have
                 # been deleted by other means
                 LOG.warning(_LW('pip nport delete failed: %r'),
                             exception)
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:12,代码来源:driver.py

示例7: get_stats

 def get_stats(self, loadbalancer_id):
     socket_path = self._get_state_file_path(loadbalancer_id, "haproxy_stats.sock", False)
     if os.path.exists(socket_path):
         parsed_stats = self._get_stats_from_socket(
             socket_path, entity_type=(STATS_TYPE_BACKEND_REQUEST | STATS_TYPE_SERVER_REQUEST)
         )
         lb_stats = self._get_backend_stats(parsed_stats)
         lb_stats["members"] = self._get_servers_stats(parsed_stats)
         return lb_stats
     else:
         LOG.warning(_LW("Stats socket not found for loadbalancer %s"), loadbalancer_id)
         return {}
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:12,代码来源:namespace_driver.py

示例8: _deploy_existing_instances

 def _deploy_existing_instances(self):
     dirs = self._retrieve_deployed_instance_dirs()
     loadbalancers = self._retrieve_db_loadbalancers_from_dirs(dirs)
     loadbalancer_ids = [loadbalancer.id for loadbalancer in loadbalancers]
     self.deployed_loadbalancer_ids.update(loadbalancer_ids)
     for loadbalancer in loadbalancers:
         try:
             self.update_instance(loadbalancer)
         except RuntimeError:
             # do not stop anything this is a minor error
             LOG.warn(_LW("Existing load balancer %s could not be deployed"
                          " on the system.") % loadbalancer.id)
开发者ID:jlongstaf,项目名称:neutron-lbaas,代码行数:12,代码来源:synchronous_namespace_driver.py

示例9: update_status

 def update_status(self, context, obj_type, obj_id, provisioning_status=None, operating_status=None):
     if not provisioning_status and not operating_status:
         LOG.warning(
             _LW(
                 "update_status for %(obj_type)s %(obj_id)s called "
                 "without specifying provisioning_status or "
                 "operating_status"
             )
             % {"obj_type": obj_type, "obj_id": obj_id}
         )
         return
     model_mapping = {
         "loadbalancer": db_models.LoadBalancer,
         "pool": db_models.PoolV2,
         "listener": db_models.Listener,
         "member": db_models.MemberV2,
         "healthmonitor": db_models.HealthMonitorV2,
     }
     if obj_type not in model_mapping:
         raise n_exc.Invalid(_("Unknown object type: %s") % obj_type)
     try:
         self.plugin.db.update_status(
             context,
             model_mapping[obj_type],
             obj_id,
             provisioning_status=provisioning_status,
             operating_status=operating_status,
         )
     except n_exc.NotFound:
         # update_status may come from agent on an object which was
         # already deleted from db with other request
         LOG.warning(
             _LW(
                 "Cannot update status: %(obj_type)s %(obj_id)s "
                 "not found in the DB, it was probably deleted "
                 "concurrently"
             ),
             {"obj_type": obj_type, "obj_id": obj_id},
         )
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:39,代码来源:agent_callbacks.py

示例10: schedule

    def schedule(self, plugin, context, pool, device_driver):
        """Schedule the pool to an active loadbalancer agent if there
        is no enabled agent hosting it.
        """
        with context.session.begin(subtransactions=True):
            lbaas_agent = plugin.get_lbaas_agent_hosting_pool(
                context, pool['id'])
            if lbaas_agent:
                LOG.debug('Pool %(pool_id)s has already been hosted'
                          ' by lbaas agent %(agent_id)s',
                          {'pool_id': pool['id'],
                           'agent_id': lbaas_agent['id']})
                return

            active_agents = plugin.get_lbaas_agents(context, active=True)
            if not active_agents:
                LOG.warning(_LW('No active lbaas agents for pool %s'),
                            pool['id'])
                return

            candidates = plugin.get_lbaas_agent_candidates(device_driver,
                                                           active_agents)
            if not candidates:
                LOG.warning(_LW('No lbaas agent supporting device driver %s'),
                            device_driver)
                return

            chosen_agent = self._schedule(candidates, plugin, context)

            binding = PoolLoadbalancerAgentBinding()
            binding.agent = chosen_agent
            binding.pool_id = pool['id']
            context.session.add(binding)
            LOG.debug('Pool %(pool_id)s is scheduled to lbaas agent '
                      '%(agent_id)s',
                      {'pool_id': pool['id'],
                       'agent_id': chosen_agent['id']})
            return chosen_agent
开发者ID:gongwayne,项目名称:Openstack,代码行数:38,代码来源:agent_scheduler.py

示例11: get_stats

 def get_stats(self, pool_id):
     socket_path = self._get_state_file_path(pool_id, 'sock', False)
     TYPE_BACKEND_REQUEST = 2
     TYPE_SERVER_REQUEST = 4
     if os.path.exists(socket_path):
         parsed_stats = self._get_stats_from_socket(
             socket_path,
             entity_type=TYPE_BACKEND_REQUEST | TYPE_SERVER_REQUEST)
         pool_stats = self._get_backend_stats(parsed_stats)
         pool_stats['members'] = self._get_servers_stats(parsed_stats)
         return pool_stats
     else:
         LOG.warning(_LW('Stats socket not found for pool %s'), pool_id)
         return {}
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:14,代码来源:namespace_driver.py

示例12: _get_stats_from_socket

    def _get_stats_from_socket(self, socket_path, entity_type):
        try:
            s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
            s.connect(socket_path)
            s.send('show stat -1 %s -1\n' % entity_type)
            raw_stats = ''
            chunk_size = 1024
            while True:
                chunk = s.recv(chunk_size)
                raw_stats += chunk
                if len(chunk) < chunk_size:
                    break

            return self._parse_stats(raw_stats)
        except socket.error as e:
            LOG.warning(_LW('Error while connecting to stats socket: %s'), e)
            return {}
开发者ID:richbrowne,项目名称:neutron-lbaas,代码行数:17,代码来源:namespace_driver.py

示例13: get_ready_devices

    def get_ready_devices(self, context, host=None):
        with context.session.begin(subtransactions=True):
            agents = self.plugin.get_lbaas_agents(context,
                                                  filters={'host': [host]})
            if not agents:
                return []
            elif len(agents) > 1:
                LOG.warning(_LW('Multiple lbaas agents found on host %s'),
                            host)
            pools = self.plugin.list_pools_on_lbaas_agent(context,
                                                          agents[0].id)
            pool_ids = [pool['id'] for pool in pools['pools']]

            qry = context.session.query(loadbalancer_db.Pool.id)
            qry = qry.filter(loadbalancer_db.Pool.id.in_(pool_ids))
            qry = qry.filter(
                loadbalancer_db.Pool.status.in_(
                    np_const.ACTIVE_PENDING_STATUSES))
            up = True  # makes pep8 and sqlalchemy happy
            qry = qry.filter(loadbalancer_db.Pool.admin_state_up == up)
            return [id for id, in qry]
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:21,代码来源:agent_driver_base.py

示例14: update_status

 def update_status(self, context, obj_type, obj_id, status):
     model_mapping = {
         'pool': loadbalancer_db.Pool,
         'vip': loadbalancer_db.Vip,
         'member': loadbalancer_db.Member,
         'health_monitor': loadbalancer_db.PoolMonitorAssociation
     }
     if obj_type not in model_mapping:
         raise n_exc.Invalid(_('Unknown object type: %s') % obj_type)
     try:
         if obj_type == 'health_monitor':
             self.plugin.update_pool_health_monitor(
                 context, obj_id['monitor_id'], obj_id['pool_id'], status)
         else:
             self.plugin.update_status(
                 context, model_mapping[obj_type], obj_id, status)
     except n_exc.NotFound:
         # update_status may come from agent on an object which was
         # already deleted from db with other request
         LOG.warning(_LW('Cannot update status: %(obj_type)s %(obj_id)s '
                         'not found in the DB, it was probably deleted '
                         'concurrently'),
                     {'obj_type': obj_type, 'obj_id': obj_id})
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:23,代码来源:agent_driver_base.py

示例15: _delete_proxy_port

    def _delete_proxy_port(self, ctx, lb):
        port_filter = {
            'name': ['proxy_' + lb.id],
        }
        ports = self.plugin.db._core_plugin.get_ports(
            ctx, filters=port_filter)
        if ports:
            proxy_port = ports[0]
            proxy_port_ip_data = proxy_port['fixed_ips'][0]
            try:
                LOG.info(_LI('Deleting LB %(lb_id)s proxy port on subnet  \
                             %(subnet_id)s with ip address %(ip_address)s') %
                         {'lb_id': lb.id,
                          'subnet_id': proxy_port_ip_data['subnet_id'],
                          'ip_address': proxy_port_ip_data['ip_address']})
                self.plugin.db._core_plugin.delete_port(
                    ctx, proxy_port['id'])

            except Exception as exception:
                # stop exception propagation, nport may have
                # been deleted by other means
                LOG.warning(_LW('Proxy port deletion failed: %r'),
                            exception)
开发者ID:bdrich,项目名称:neutron-lbaas,代码行数:23,代码来源:v2_driver.py


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