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

Python i18n._LW函数代码示例

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

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



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

示例1: _sync_ports

    def _sync_ports(self, ctx):
        LOG.debug("OVN-NB Sync ports started")

        lports = self.ovn_api.get_all_logical_ports_ids()

        for port in self.core_plugin.get_ports(ctx):
            try:
                if self.mode == SYNC_MODE_REPAIR:
                    self.core_plugin.create_port_in_ovn(port)
                res = lports.pop(port['id'], None)
                if self.mode == SYNC_MODE_LOG:
                    if res is None:
                        LOG.warn(_LW("Port found in Neutron but not in OVN"
                                     "DB, port_id=%s"),
                                 port['id'])

            except RuntimeError:
                LOG.warn(_LW("Create port failed for"
                             " port %s"), port['id'])

        # Only delete logical port if it was previously created by neutron
        with self.ovn_api.transaction() as txn:
            for lport, ext_ids in lports.items():
                if ovn_const.OVN_PORT_NAME_EXT_ID_KEY in ext_ids:
                    if self.mode == SYNC_MODE_REPAIR:
                        txn.add(self.ovn_api.delete_lport(lport))
                    if self.mode == SYNC_MODE_LOG:
                        LOG.warn(_LW("Port found in OVN but not in Neutron,"
                                     " port_name=%s"),
                                 ext_ids[ovn_const.OVN_PORT_NAME_EXT_ID_KEY])

        LOG.debug("OVN-NB Sync ports finished")
开发者ID:numansiddique,项目名称:networking-ovn,代码行数:32,代码来源:ovn_nb_sync.py


示例2: _execute

    def _execute(cls, *args):
        """Run received command and return the output."""
        command = [CONF.virtualbox.vboxmanage_cmd, "--nologo"]
        command.extend(args)
        LOG.debug("Execute: %s", command)
        stdout, stderr = None, None
        for _ in range(CONF.virtualbox.retry_count):
            try:
                process = subprocess.Popen(
                    command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                    universal_newlines=True)
            except subprocess.CalledProcessError as exc:
                stderr = exc.output
            else:
                stdout, stderr = process.communicate()

            if stderr and constants.VBOX_E_ACCESSDENIED in stderr:
                LOG.warning(_LW("Something went wrong, trying again."))
                time.sleep(CONF.virtualbox.retry_interval)
                continue

            break
        else:
            LOG.warning(_LW("Failed to process command."))

        return (stdout, stderr)
开发者ID:alexcoman,项目名称:vbox-neutron-agent,代码行数:26,代码来源:vboxapi.py


示例3: get_ml2_port_bond_data

    def get_ml2_port_bond_data(self, ctx, port_id, device_id):
        core_plugin = manager.NeutronManager.get_plugin()
        port_context = core_plugin.get_bound_port_context(
            ctx, port_id, device_id)
        if not port_context:
            LOG.warning(_LW("Device %(device)s requested by agent "
                         "%(agent_id)s not found in database"),
                        {'device': device_id, 'agent_id': port_id})
            return None

        port = port_context.current

        try:
            segment = port_context.network.network_segments[0]
        except KeyError:
            if not segment:
                LOG.warning(_LW("Device %(device)s requested by agent "
                             " on network %(network_id)s not "
                             "bound, vif_type: "),
                            {'device': device_id,
                             'network_id': port['network_id']})
                return {}

        entry = {'device': device_id,
                 'network_id': port['network_id'],
                 'port_id': port_id,
                 'mac_address': port['mac_address'],
                 'admin_state_up': port['admin_state_up'],
                 'network_type': segment[api.NETWORK_TYPE],
                 'segmentation_id': segment[api.SEGMENTATION_ID],
                 'physical_network': segment[api.PHYSICAL_NETWORK],
                 'fixed_ips': port['fixed_ips'],
                 'device_owner': port['device_owner']}
        LOG.debug(("Returning: %s"), entry)
        return entry
开发者ID:cyclefusion,项目名称:dragonflow,代码行数:35,代码来源:l3_controller_plugin.py


示例4: call_driver

 def call_driver(self, action, network, **action_kwargs):
     """Invoke an action on a DHCP driver instance."""
     LOG.debug('Calling driver for network: %(net)s action: %(action)s',
               {'net': network.id, 'action': action})
     try:
         # the Driver expects something that is duck typed similar to
         # the base models.
         driver = self.dhcp_driver_cls(self.conf,
                                       network,
                                       self._process_monitor,
                                       self.dhcp_version,
                                       self.plugin_rpc)
         getattr(driver, action)(**action_kwargs)
         return True
     except exceptions.Conflict:
         # No need to resync here, the agent will receive the event related
         # to a status update for the network
         LOG.warning(_LW('Unable to %(action)s dhcp for %(net_id)s: there '
                         'is a conflict with its current state; please '
                         'check that the network and/or its subnet(s) '
                         'still exist.'),
                     {'net_id': network.id, 'action': action})
     except Exception as e:
         self.schedule_resync(e, network.id)
         if (isinstance(e, oslo_messaging.RemoteError)
             and e.exc_type == 'NetworkNotFound'
             or isinstance(e, exceptions.NetworkNotFound)):
             LOG.warning(_LW("Network %s has been deleted."), network.id)
         else:
             LOG.exception(_LE('Unable to %(action)s dhcp for %(net_id)s.'),
                           {'net_id': network.id, 'action': action})
开发者ID:bradleyjones,项目名称:neutron,代码行数:31,代码来源:agent.py


示例5: _router_removed

    def _router_removed(self, router_id, deconfigure=True):
        """Operations when a router is removed.

        Get the RouterInfo object corresponding to the router in the service
        helpers's router_info dict. If deconfigure is set to True,
        remove this router's configuration from the hosting device.
        :param router_id: id of the router
        :param deconfigure: if True, the router's configuration is deleted from
        the hosting device.
        :return: None
        """
        ri = self.router_info.get(router_id)
        if ri is None:
            LOG.warning(_LW("Info for router %s was not found. "
                       "Skipping router removal"), router_id)
            return
        ri.router['gw_port'] = None
        ri.router[l3_constants.INTERFACE_KEY] = []
        ri.router[l3_constants.FLOATINGIP_KEY] = []
        try:
            if deconfigure:
                self._process_router(ri)
                driver = self._drivermgr.get_driver(router_id)
                driver.router_removed(ri, deconfigure)
                self._drivermgr.remove_driver(router_id)
            del self.router_info[router_id]
            self.removed_routers.discard(router_id)
        except cfg_exceptions.DriverException:
            LOG.warning(_LW("Router remove for router_id: %s was incomplete. "
                       "Adding the router to removed_routers list"), router_id)
            self.removed_routers.add(router_id)
            # remove this router from updated_routers if it is there. It might
            # end up there too if exception was thrown earlier inside
            # `_process_router()`
            self.updated_routers.discard(router_id)
开发者ID:Kannan-onecloud,项目名称:networking-cisco,代码行数:35,代码来源:routing_svc_helper.py


示例6: _get_candidates

    def _get_candidates(self, plugin, context, sync_router):
        """Return L3 agents where a router could be scheduled."""
        with context.session.begin(subtransactions=True):
            # allow one router is hosted by just
            # one enabled l3 agent hosting since active is just a
            # timing problem. Non-active l3 agent can return to
            # active any time
            current_l3_agents = plugin.get_l3_agents_hosting_routers(
                context, [sync_router['id']], admin_state_up=True)
            is_router_distributed = sync_router.get('distributed', False)
            if current_l3_agents and not is_router_distributed:
                LOG.debug('Router %(router_id)s has already been hosted'
                          ' by L3 agent %(agent_id)s',
                          {'router_id': sync_router['id'],
                           'agent_id': current_l3_agents[0]['id']})
                return []

            active_l3_agents = plugin.get_l3_agents(context, active=True)
            if not active_l3_agents:
                LOG.warn(_LW('No active L3 agents'))
                return []
            potential_candidates = list(
                set(active_l3_agents) - set(current_l3_agents))
            new_l3agents = []
            if potential_candidates:
                new_l3agents = plugin.get_l3_agent_candidates(
                    context, sync_router, potential_candidates)
                if not new_l3agents:
                    LOG.warn(_LW('No L3 agents can host the router %s'),
                             sync_router['id'])
            return new_l3agents
开发者ID:eros-lige,项目名称:UPCloud-neutron,代码行数:31,代码来源:l3_agent_scheduler.py


示例7: _sync_networks

    def _sync_networks(self, ctx):
        LOG.debug("OVN-NB Sync networks started")

        lswitches = self.ovn_api.get_all_logical_switches_ids()

        for network in self.core_plugin.get_networks(ctx):
            net_context = driver_context.NetworkContext(self.core_plugin, ctx, network)
            try:
                if self.mode == SYNC_MODE_REPAIR:
                    self.driver.create_network_postcommit(net_context)
                res = lswitches.pop(utils.ovn_name(net_context.current["id"]), None)
                if self.mode == SYNC_MODE_LOG:
                    if res is None:
                        LOG.warn(
                            _LW("Network found in Neutron but not in OVN" "DB, network_id=%s"),
                            net_context.current["id"],
                        )

            except RuntimeError:
                LOG.warn(_LW("Create network postcommit failed for " "network %s"), network["id"])

        # Only delete logical switch if it was previously created by neutron
        with self.ovn_api.transaction() as txn:
            for lswitch, ext_ids in lswitches.items():
                if ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY in ext_ids:
                    if self.mode == SYNC_MODE_REPAIR:
                        txn.add(self.ovn_api.delete_lswitch(lswitch))
                    if self.mode == SYNC_MODE_LOG:
                        LOG.warn(
                            _LW("Network found in OVN but not in Neutron," " network_name=%s"),
                            (ext_ids[ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY]),
                        )

        LOG.debug("OVN-NB Sync networks finished")
开发者ID:uni2u,项目名称:networking-ovn,代码行数:34,代码来源:ovn_nb_sync.py


示例8: _sync_base

    def _sync_base(self):
        ctx = context.get_admin_context()
        # Sync Networks
        for network in self.core_plugin.get_networks(ctx):
            mech_context = driver_context.NetworkContext(self.core_plugin, ctx,
                                                         network)
            try:
                self.driver.create_network_postcommit(mech_context)
            except Exception:
                LOG.warn(_LW("Create network postcommit failed for "
                             "network %s"), network['id'])

        # Sync Subnets
        for subnet in self.core_plugin.get_subnets(ctx):
            mech_context = driver_context.SubnetContext(self.core_plugin, ctx,
                                                        subnet)
            try:
                self.driver.create_subnet_postcommit(mech_context)
            except Exception:
                LOG.warn(_LW("Create subnet postcommit failed for"
                             " subnet %s"), subnet['id'])

        # Sync Ports (compute/gateway/dhcp)
        for port in self.core_plugin.get_ports(ctx):
            _, binding = l2_db.get_locked_port_and_binding(ctx.session,
                                                           port['id'])
            network = self.core_plugin.get_network(ctx, port['network_id'])
            mech_context = driver_context.PortContext(self.core_plugin, ctx,
                                                      port, network, binding,
                                                      [])
            try:
                self.driver.create_port_postcommit(mech_context)
            except Exception:
                LOG.warn(_LW("Create port postcommit failed for"
                             " port %s"), port['id'])
开发者ID:Akanksha08,项目名称:neutron,代码行数:35,代码来源:apic_sync.py


示例9: get_nsx_security_group_id

def get_nsx_security_group_id(session, cluster, neutron_id):
    """Return the NSX sec profile uuid for a given neutron sec group.

    First, look up the Neutron database. If not found, execute
    a query on NSX platform as the mapping might be missing.
    NOTE: Security groups are called 'security profiles' on the NSX backend.
    """
    nsx_id = nsx_db.get_nsx_security_group_id(session, neutron_id)
    if not nsx_id:
        # Find security profile on backend.
        # This is a rather expensive query, but it won't be executed
        # more than once for each security group in Neutron's lifetime
        nsx_sec_profiles = secgrouplib.query_security_profiles(
            cluster, '*',
            filters={'tag': neutron_id,
                     'tag_scope': 'q_sec_group_id'})
        # Only one result expected
        # NOTE(salv-orlando): Not handling the case where more than one
        # security profile is found with the same neutron port tag
        if not nsx_sec_profiles:
            LOG.warn(_LW("Unable to find NSX security profile for Neutron "
                         "security group %s"), neutron_id)
            return
        elif len(nsx_sec_profiles) > 1:
            LOG.warn(_LW("Multiple NSX security profiles found for Neutron "
                         "security group %s"), neutron_id)
        nsx_sec_profile = nsx_sec_profiles[0]
        nsx_id = nsx_sec_profile['uuid']
        with session.begin(subtransactions=True):
            # Create DB mapping
            nsx_db.add_neutron_nsx_security_group_mapping(
                session, neutron_id, nsx_id)
    return nsx_id
开发者ID:wubala,项目名称:vmware-nsx,代码行数:33,代码来源:nsx_utils.py


示例10: treat_device

    def treat_device(self, device, pci_slot, admin_state_up, spoofcheck=True):
        if self.eswitch_mgr.device_exists(device, pci_slot):
            try:
                self.eswitch_mgr.set_device_spoofcheck(device, pci_slot,
                                                       spoofcheck)
            except Exception:
                LOG.warning(_LW("Failed to set spoofcheck for device %s"),
                            device)
            LOG.info(_LI("Device %(device)s spoofcheck %(spoofcheck)s"),
                     {"device": device, "spoofcheck": spoofcheck})

            try:
                self.eswitch_mgr.set_device_state(device, pci_slot,
                                                  admin_state_up)
            except exc.IpCommandOperationNotSupportedError:
                LOG.warning(_LW("Device %s does not support state change"),
                            device)
            except exc.SriovNicError:
                LOG.warning(_LW("Failed to set device %s state"), device)
                return
            if admin_state_up:
                # update plugin about port status
                self.plugin_rpc.update_device_up(self.context,
                                                 device,
                                                 self.agent_id,
                                                 cfg.CONF.host)
            else:
                self.plugin_rpc.update_device_down(self.context,
                                                   device,
                                                   self.agent_id,
                                                   cfg.CONF.host)
        else:
            LOG.info(_LI("No device with MAC %s defined on agent."), device)
开发者ID:davidcusatis,项目名称:neutron,代码行数:33,代码来源:sriov_nic_agent.py


示例11: _get_portpair_detail_info

    def _get_portpair_detail_info(self, portpair_id):
        """Get port detail.

        @param: portpair_id: uuid
        @return: (host_id, local_ip, network_type, segment_id,
        service_insert_type): tuple
        """

        core_plugin = manager.NeutronManager.get_plugin()
        port_detail = core_plugin.get_port(self.admin_context, portpair_id)
        host_id, local_ip, network_type, segment_id, mac_address = (
            (None, ) * 5)

        if port_detail:
            host_id = port_detail['binding:host_id']
            network_id = port_detail['network_id']
            mac_address = port_detail['mac_address']
            network_info = core_plugin.get_network(
                self.admin_context, network_id)
            network_type = network_info['provider:network_type']
            segment_id = network_info['provider:segmentation_id']

        if network_type != np_const.TYPE_VXLAN:
            LOG.warn(_LW("Currently only support vxlan network"))
            return ((None, ) * 5)
        elif not host_id:
            LOG.warn(_LW("This port has not been binding"))
            return ((None, ) * 5)
        else:
            driver = core_plugin.type_manager.drivers.get(network_type)
            host_endpoint = driver.obj.get_endpoint_by_host(host_id)
            local_ip = host_endpoint['ip_address']

        return host_id, local_ip, network_type, segment_id, mac_address
开发者ID:CNlukai,项目名称:networking-sfc,代码行数:34,代码来源:driver.py


示例12: _inspect_instance

    def _inspect_instance(self, instance_name):
        """Get the network information from an instance."""
        network = {}
        try:
            instace_info = self._vbox.show_vm_info(instance_name)
        except exception.InstanceNotFound:
            LOG.warning(_LW("Failed to get specification for `%(instance)s`"),
                        {"instance": instance_name})
            return

        description = instace_info.get(constants.VM_DESCRIPTION)
        if not self._process_description(description):
            LOG.warning(_LW("Invalid description for `%(instance)s`: "
                            "%(description)s"),
                        {"instance": instance_name,
                         "description": description})
            return

        for field, value in instace_info.items():
            if field[:-1] in constants.NETWORK_FIELDS:
                network.setdefault(field[-1], {})[field[:-1]] = value

        for nic_index in network:
            mac_address = network[nic_index].get(constants.MAC_ADDRESS)
            device_id = self._device_map.get(mac_address)
            nic_mode = network[nic_index].get(constants.NIC_MODE)

            if device_id and nic_mode != constants.NIC_MODE_NONE:
                self._nic[device_id] = network[nic_index]
                self._nic[device_id]["index"] = nic_index
                self._nic[device_id]["instance"] = instance_name
                self._nic[device_id]["state"] = instace_info.get(
                    constants.VM_STATE)
开发者ID:alexcoman,项目名称:vbox-neutron-agent,代码行数:33,代码来源:vboxapi.py


示例13: _load_all_extensions_from_path

 def _load_all_extensions_from_path(self, path):
     # Sorting the extension list makes the order in which they
     # are loaded predictable across a cluster of load-balanced
     # Neutron Servers
     for f in sorted(os.listdir(path)):
         try:
             LOG.debug('Loading extension file: %s', f)
             mod_name, file_ext = os.path.splitext(os.path.split(f)[-1])
             ext_path = os.path.join(path, f)
             if file_ext.lower() == '.py' and not mod_name.startswith('_'):
                 mod = imp.load_source(mod_name, ext_path)
                 ext_name = mod_name[0].upper() + mod_name[1:]
                 new_ext_class = getattr(mod, ext_name, None)
                 if not new_ext_class:
                     LOG.warn(_LW('Did not find expected name '
                                  '"%(ext_name)s" in %(file)s'),
                              {'ext_name': ext_name,
                               'file': ext_path})
                     continue
                 new_ext = new_ext_class()
                 self.add_extension(new_ext)
         except Exception as exception:
             LOG.warn(_LW("Extension file %(f)s wasn't loaded due to "
                          "%(exception)s"),
                      {'f': f, 'exception': exception})
开发者ID:glove747,项目名称:liberty-neutron,代码行数:25,代码来源:extensions.py


示例14: 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:Vikash082,项目名称:neutron-lbaas,代码行数:29,代码来源:agent_callbacks.py


示例15: _get_port_infos

    def _get_port_infos(self, context, port, agent_host):
        if not agent_host:
            return

        session = db_api.get_session()
        agent = self.get_agent_by_host(session, agent_host)
        if not agent:
            return

        agent_ip = self.get_agent_ip(agent)
        if not agent_ip:
            LOG.warning(_LW("Unable to retrieve the agent ip, check the agent "
                            "configuration."))
            return

        segment = context.bottom_bound_segment
        if not segment:
            LOG.warning(_LW("Port %(port)s updated by agent %(agent)s "
                            "isn't bound to any segment"),
                        {'port': port['id'], 'agent': agent})
            return

        network_types = self.get_agent_l2pop_network_types(agent)
        if network_types is None:
            network_types = self.get_agent_tunnel_types(agent)
        if segment['network_type'] not in network_types:
            return

        fdb_entries = self._get_port_fdb_entries(port)

        return agent, agent_host, agent_ip, segment, fdb_entries
开发者ID:Akanksha08,项目名称:neutron,代码行数:31,代码来源:mech_driver.py


示例16: get_candidates

    def get_candidates(self, plugin, context, sync_router):
        """Return L3 agents where a router could be scheduled."""
        with context.session.begin(subtransactions=True):
            # allow one router is hosted by just
            # one enabled l3 agent hosting since active is just a
            # timing problem. Non-active l3 agent can return to
            # active any time
            l3_agents = plugin.get_l3_agents_hosting_routers(
                context, [sync_router['id']], admin_state_up=True)
            if l3_agents and not sync_router.get('distributed', False):
                LOG.debug('Router %(router_id)s has already been hosted'
                          ' by L3 agent %(agent_id)s',
                          {'router_id': sync_router['id'],
                           'agent_id': l3_agents[0]['id']})
                return

            active_l3_agents = plugin.get_l3_agents(context, active=True)
            if not active_l3_agents:
                LOG.warn(_LW('No active L3 agents'))
                return
            new_l3agents = plugin.get_l3_agent_candidates(context,
                                                          sync_router,
                                                          active_l3_agents)
            old_l3agentset = set(l3_agents)
            if sync_router.get('distributed', False):
                new_l3agentset = set(new_l3agents)
                candidates = list(new_l3agentset - old_l3agentset)
            else:
                candidates = new_l3agents
                if not candidates:
                    LOG.warn(_LW('No L3 agents can host the router %s'),
                             sync_router['id'])

            return candidates
开发者ID:CiscoSystems,项目名称:neutron,代码行数:34,代码来源:l3_agent_scheduler.py


示例17: _populate_policy_profiles

 def _populate_policy_profiles(self):
     """Populate all the policy profiles from VSM."""
     hosts = self.n1kvclient.get_vsm_hosts()
     for vsm_ip in hosts:
         try:
             policy_profiles = self.n1kvclient.list_port_profiles(vsm_ip)
             vsm_profiles = {}
             plugin_profiles_set = set()
             # Fetch policy profiles from VSM
             for profile_name in policy_profiles:
                 profile_id = (policy_profiles[profile_name]
                               [n1kv_const.PROPERTIES][n1kv_const.ID])
                 vsm_profiles[profile_id] = profile_name
             # Fetch policy profiles previously populated
             for profile in self._get_policy_profiles_by_host(vsm_ip):
                 plugin_profiles_set.add(profile.id)
             vsm_profiles_set = set(vsm_profiles)
             # Update database if the profile sets differ.
             if vsm_profiles_set.symmetric_difference(plugin_profiles_set):
                 # Add new profiles to database if they were created in VSM
                 for pid in vsm_profiles_set.difference(
                                             plugin_profiles_set):
                     self._add_policy_profile(pid, vsm_profiles[pid],
                                              vsm_ip)
                 # Delete profiles from database if they were deleted in VSM
                 for pid in plugin_profiles_set.difference(
                                                vsm_profiles_set):
                     if not n1kv_db.policy_profile_in_use(pid):
                         self._remove_policy_profile(pid, vsm_ip)
                     else:
                         LOG.warning(_LW('Policy profile %s in use'), pid)
         except (n1kv_exc.VSMError, n1kv_exc.VSMConnectionFailed):
             with excutils.save_and_reraise_exception(reraise=False):
                 LOG.warning(_LW('No policy profile populated from VSM'))
开发者ID:aboik,项目名称:networking-cisco,代码行数:34,代码来源:policy_profile_service.py


示例18: get_vif_port_set

 def get_vif_port_set(self):
     edge_ports = set()
     args = ['--format=json', '--', '--columns=external_ids,ofport',
             '--if-exists', 'list', 'Interface']
     args += self.get_port_name_list()
     result = self.run_vsctl(args, check_error=True)
     if not result:
         return edge_ports
     for row in jsonutils.loads(result)['data']:
         external_ids = dict(row[0][1])
         # Do not consider VIFs which aren't yet ready
         # This can happen when ofport values are either [] or ["set", []]
         # We will therefore consider only integer values for ofport
         ofport = row[1]
         if not isinstance(ofport, numbers.Integral):
             LOG.warn(_LW("Found not yet ready openvswitch port: %s"), row)
         elif ofport < 1:
             LOG.warn(_LW("Found failed openvswitch port: %s"), row)
         elif 'attached-mac' in external_ids:
             if "iface-id" in external_ids:
                 edge_ports.add(external_ids['iface-id'])
             elif "xs-vif-uuid" in external_ids:
                 # if this is a xenserver and iface-id is not
                 # automatically synced to OVS from XAPI, we grab it
                 # from XAPI directly
                 iface_id = self.get_xapi_iface_id(
                     external_ids["xs-vif-uuid"])
                 edge_ports.add(iface_id)
     return edge_ports
开发者ID:gampel,项目名称:neutron,代码行数:29,代码来源:ovs_lib.py


示例19: _recv_data

 def _recv_data(self):
     chunks = []
     lc = rc = 0
     prev_char = None
     while True:
         try:
             response = self.socket.recv(n_const.BUFFER_SIZE)
             if response:
                 response = response.decode('utf8')
                 for i, c in enumerate(response):
                     if c == '{' and not (prev_char and
                                          prev_char == '\\'):
                         lc += 1
                     elif c == '}' and not (prev_char and
                                            prev_char == '\\'):
                         rc += 1
                     if lc == rc and lc is not 0:
                         chunks.append(response[0:i + 1])
                         message = "".join(chunks)
                         return message
                     prev_char = c
                 chunks.append(response)
             else:
                 LOG.warning(_LW("Did not receive any reply from the OVSDB "
                                 "server"))
                 return
         except (socket.error, socket.timeout):
             LOG.warning(_LW("Did not receive any reply from the OVSDB "
                             "server"))
             return
开发者ID:koteswar16,项目名称:networking-l2gw,代码行数:30,代码来源:ovsdb_writer.py


示例20: send_events

 def send_events(self, batched_events):
     LOG.debug("Sending events: %s", batched_events)
     try:
         response = self.nclient.server_external_events.create(
             batched_events)
     except nova_exceptions.NotFound:
         LOG.warning(_LW("Nova returned NotFound for event: %s"),
                     batched_events)
     except Exception:
         LOG.exception(_LE("Failed to notify nova on events: %s"),
                       batched_events)
     else:
         if not isinstance(response, list):
             LOG.error(_LE("Error response returned from nova: %s"),
                       response)
             return
         response_error = False
         for event in response:
             try:
                 code = event['code']
             except KeyError:
                 response_error = True
                 continue
             if code != 200:
                 LOG.warning(_LW("Nova event: %s returned with failed "
                                 "status"), event)
             else:
                 LOG.info(_LI("Nova event response: %s"), event)
         if response_error:
             LOG.error(_LE("Error response returned from nova: %s"),
                       response)
开发者ID:Akanksha08,项目名称:neutron,代码行数:31,代码来源:nova.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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