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

Python i18n._LE函数代码示例

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

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



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

示例1: port_up_segment_mode

 def port_up_segment_mode(self, lldpad_port, port_name, port_uuid, mac,
                          net_uuid, segmentation_id, oui):
     lvm = self.local_vlan_map.get(net_uuid)
     if lvm and lvm.late_binding_vlan:
         vdp_vlan = lvm.late_binding_vlan
         ovs_cb_data = {'obj': self, 'mac': mac,
                        'port_uuid': port_uuid, 'net_uuid': net_uuid}
         lldpad_port.send_vdp_vnic_up(port_uuid=port_uuid,
                                      vsiid=port_uuid, gid=segmentation_id,
                                      mac=mac, vlan=vdp_vlan, oui=oui,
                                      vsw_cb_fn=self.vdp_vlan_change,
                                      vsw_cb_data=ovs_cb_data)
         lvm.port_uuid_list[port_uuid] = port_uuid
         return True
     else:
         int_br = self.integ_br_obj
         lvid = int_br.get_port_vlan_tag(port_name)
         if lvid != cconstants.INVALID_VLAN:
             ret, vdp_vlan = self.provision_vdp_overlay_networks(
                 port_uuid, mac, net_uuid, segmentation_id, lvid, oui)
             if not lvm:
                 lvm = LocalVlan(lvid, segmentation_id)
                 self.local_vlan_map[net_uuid] = lvm
             lvm.lvid = lvid
             lvm.port_uuid_list[port_uuid] = port_uuid
             if vdp_vlan != cconstants.INVALID_VLAN:
                 lvm.late_binding_vlan = vdp_vlan
             else:
                 LOG.error(_LE("Cannot provision VDP overlay"))
             return ret
         else:
             LOG.error(_LE("Invalid VLAN"))
             return False
开发者ID:brshravan86,项目名称:networking-cisco,代码行数:33,代码来源:ovs_vdp.py


示例2: run_idl

    def run_idl(self, txn):
        try:
            port = self.row_by_value('Port', 'name', self.port)
        except RowNotFound:
            if self.if_exists:
                return
            msg = _LE("Port %s does not exist") % self.port
            raise RuntimeError(msg)
        if self.bridge:
            br = self.row_by_value('Bridge', 'name', self.bridge)
        else:
            br = next(b for b in self.api._tables['Bridge'].rows.values()
                      if port in b.ports)

        if port.uuid not in br.ports and not self.if_exists:
            # TODO(twilson) Make real errors across both implementations
            msg = _LE("Port %(port)s does not exist on %(bridge)s!") % {
                'port': self.name, 'bridge': self.bridge
            }
            LOG.error(msg)
            raise RuntimeError(msg)

        br.verify('ports')
        ports = br.ports
        ports.remove(port)
        br.ports = ports

        # Also remove port/interface directly for indexing?
        port.verify('interfaces')
        for iface in port.interfaces:
            del self.api._tables['Interface'].rows[iface.uuid]
        del self.api._tables['Port'].rows[port.uuid]
开发者ID:Akanksha08,项目名称:neutron,代码行数:32,代码来源:commands.py


示例3: delete_addr_and_conntrack_state

    def delete_addr_and_conntrack_state(self, cidr):
        """Delete an address along with its conntrack state

        This terminates any active connections through an IP.

        cidr: the IP address for which state should be removed.  This can be
            passed as a string with or without /NN.  A netaddr.IPAddress or
            netaddr.Network representing the IP address can also be passed.
        """
        self.addr.delete(cidr)

        ip_str = str(netaddr.IPNetwork(cidr).ip)
        ip_wrapper = IPWrapper(namespace=self.namespace)

        # Delete conntrack state for ingress traffic
        # If 0 flow entries have been deleted
        # conntrack -D will return 1
        try:
            ip_wrapper.netns.execute(["conntrack", "-D", "-d", ip_str],
                                     check_exit_code=True,
                                     extra_ok_codes=[1])

        except RuntimeError:
            LOG.exception(_LE("Failed deleting ingress connection state of"
                              " floatingip %s"), ip_str)

        # Delete conntrack state for egress traffic
        try:
            ip_wrapper.netns.execute(["conntrack", "-D", "-q", ip_str],
                                     check_exit_code=True,
                                     extra_ok_codes=[1])
        except RuntimeError:
            LOG.exception(_LE("Failed deleting egress connection state of"
                              " floatingip %s"), ip_str)
开发者ID:Raghunanda,项目名称:neutron,代码行数:34,代码来源:ip_lib.py


示例4: create_router

    def create_router(self, host, username, password, rbridge_id, router_id):
        """create vrf and associate vrf."""
        router_id = router_id[0:11]
        vrf_name = template.OS_VRF_NAME.format(id=router_id)
        rd = router_id + ":" + router_id
        try:
            mgr = self.connect(host, username, password)
            self.create_vrf(mgr, rbridge_id, vrf_name)
        except Exception:
            with excutils.save_and_reraise_exception():
                LOG.exception(_LE("NETCONF error"))
                self.close_session()
        try:
            # For Nos5.0.0
            self.configure_rd_for_vrf(mgr, rbridge_id, vrf_name, rd)
            self.configure_address_family_for_vrf(mgr, rbridge_id, vrf_name)
        except Exception:
            with excutils.save_and_reraise_exception() as ctxt:
                try:
                    # This is done because on 4.0.0 rd doesnt accept alpha
                    # character nor hyphen
                    rd = "".join(i for i in router_id if i in "0123456789")
                    rd = rd[:4] + ":" + rd[:4]
                    self.configure_rd_for_vrf(mgr, rbridge_id, vrf_name, rd)
                    self.configure_address_family_for_vrf_v1(mgr,
                                                             rbridge_id,
                                                             vrf_name)
                except Exception:
                    with excutils.save_and_reraise_exception():
                        LOG.exception(_LE("NETCONF error"))
                        self.close_session()

                ctxt.reraise = False
开发者ID:afori,项目名称:neutron,代码行数:33,代码来源:nosdriver.py


示例5: get

    def get(self, path, etag=None, raw=False):
        json_result = None
        etag_out = None
        headers = {'accept': 'application/json',
                   'content-type': 'application/json'}
        if etag:
            headers['ETag'] = etag

        try:
            result = self.session_op("get", path, raw, headers=headers)

            if 'etag' in result.headers:
                etag_out = result.headers['etag']

            json_result = result.json()

            if result.status_code == "404":
                LOG.error(_LE("%(msg)s %(detail)s"),
                          {'msg': json_result["message"],
                           'detail': json_result["details"]})

        except Exception:
            LOG.error(_LE("exception when GET operation"))
            raise

        r = [json_result]
        if etag_out:
            r.append(etag_out)

        return [json_result]
开发者ID:TonyChengTW,项目名称:OpenStack_Liberty_Control,代码行数:30,代码来源:smc_api.py


示例6: _check_config_params

    def _check_config_params(self):
        """Check items in configuration files.

        Check for required and invalid configuration items.
        The actual values are not verified for correctness.
        """
        if not self.conf.interface_driver:
            msg = _LE('An interface driver must be specified')
            LOG.error(msg)
            raise SystemExit(1)

        if not self.conf.use_namespaces and not self.conf.router_id:
            msg = _LE('Router id is required if not using namespaces.')
            LOG.error(msg)
            raise SystemExit(1)

        if self.conf.ipv6_gateway:
            # ipv6_gateway configured. Check for valid v6 link-local address.
            try:
                msg = _LE("%s used in config as ipv6_gateway is not a valid "
                          "IPv6 link-local address."),
                ip_addr = netaddr.IPAddress(self.conf.ipv6_gateway)
                if ip_addr.version != 6 or not ip_addr.is_link_local():
                    LOG.error(msg, self.conf.ipv6_gateway)
                    raise SystemExit(1)
            except netaddr.AddrFormatError:
                LOG.error(msg, self.conf.ipv6_gateway)
                raise SystemExit(1)
开发者ID:kkxue,项目名称:neutron,代码行数:28,代码来源:agent.py


示例7: main

def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    try:
        config_parser = SriovNicAgentConfigParser()
        config_parser.parse()
        device_mappings = config_parser.device_mappings
        exclude_devices = config_parser.exclude_devices

    except ValueError:
        LOG.exception(_LE("Failed on Agent configuration parse. "
                          "Agent terminated!"))
        raise SystemExit(1)
    LOG.info(_LI("Physical Devices mappings: %s"), device_mappings)
    LOG.info(_LI("Exclude Devices: %s"), exclude_devices)

    polling_interval = cfg.CONF.AGENT.polling_interval
    try:
        agent = SriovNicSwitchAgent(device_mappings,
                                    exclude_devices,
                                    polling_interval)
    except exc.SriovNicError:
        LOG.exception(_LE("Agent Initialization Failed"))
        raise SystemExit(1)
    # Start everything.
    LOG.info(_LI("Agent initialized successfully, now running... "))
    agent.daemon_loop()
开发者ID:paninetworks,项目名称:neutron,代码行数:28,代码来源:sriov_nic_agent.py


示例8: load_class_by_alias_or_classname

def load_class_by_alias_or_classname(namespace, name):
    """Load class using stevedore alias or the class name
    :param namespace: namespace where the alias is defined
    :param name: alias or class name of the class to be loaded
    :returns class if calls can be loaded
    :raises ImportError if class cannot be loaded
    """

    if not name:
        LOG.error(_LE("Alias or class name is not set"))
        raise ImportError(_("Class not found."))
    try:
        # Try to resolve class by alias
        mgr = driver.DriverManager(namespace, name)
        class_to_load = mgr.driver
    except RuntimeError:
        e1_info = sys.exc_info()
        # Fallback to class name
        try:
            class_to_load = importutils.import_class(name)
        except (ImportError, ValueError):
            LOG.error(_LE("Error loading class by alias"),
                      exc_info=e1_info)
            LOG.error(_LE("Error loading class by class name"),
                      exc_info=True)
            raise ImportError(_("Class not found."))
    return class_to_load
开发者ID:pmichali,项目名称:neutron-lib,代码行数:27,代码来源:utils.py


示例9: process_create_port

 def process_create_port(self, context, data, result):
     """Implementation of abstract method from ExtensionDriver class."""
     port_id = result.get('id')
     policy_profile_attr = data.get(constants.N1KV_PROFILE)
     if not attributes.is_attr_set(policy_profile_attr):
         policy_profile_attr = (cfg.CONF.ml2_cisco_n1kv.
                                default_policy_profile)
     with context.session.begin(subtransactions=True):
         try:
             n1kv_db.get_policy_binding(port_id, context.session)
         except n1kv_exc.PortBindingNotFound:
             if not uuidutils.is_uuid_like(policy_profile_attr):
                 policy_profile = n1kv_db.get_policy_profile_by_name(
                     policy_profile_attr,
                     context.session)
                 if policy_profile:
                     policy_profile_attr = policy_profile.id
                 else:
                     LOG.error(_LE("Policy Profile %(profile)s does "
                                   "not exist."),
                               {"profile": policy_profile_attr})
                     raise ml2_exc.MechanismDriverError()
             elif not (n1kv_db.get_policy_profile_by_uuid(
                          context.session,
                          policy_profile_attr)):
                 LOG.error(_LE("Policy Profile %(profile)s does not "
                               "exist."),
                           {"profile": policy_profile_attr})
                 raise ml2_exc.MechanismDriverError()
             n1kv_db.add_policy_binding(port_id,
                                        policy_profile_attr,
                                        context.session)
     result[constants.N1KV_PROFILE] = policy_profile_attr
开发者ID:Akanksha08,项目名称:neutron,代码行数:33,代码来源:n1kv_ext_driver.py


示例10: _get_profile_id

 def _get_profile_id(cls, p_type, resource, name):
     try:
         tenant_id = manager.NeutronManager.get_service_plugins()[
             constants.L3_ROUTER_NAT].l3_tenant_id()
     except AttributeError:
         return
     if tenant_id is None:
         return
     core_plugin = manager.NeutronManager.get_plugin()
     if p_type == 'net_profile':
         profiles = core_plugin.get_network_profiles(
             n_context.get_admin_context(),
             {'tenant_id': [tenant_id], 'name': [name]},
             ['id'])
     else:
         profiles = core_plugin.get_policy_profiles(
             n_context.get_admin_context(),
             {'tenant_id': [tenant_id], 'name': [name]},
             ['id'])
     if len(profiles) == 1:
         return profiles[0]['id']
     elif len(profiles) > 1:
         # Profile must have a unique name.
         LOG.error(_LE('The %(resource)s %(name)s does not have unique '
                       'name. Please refer to admin guide and create one.'),
                   {'resource': resource, 'name': name})
     else:
         # Profile has not been created.
         LOG.error(_LE('There is no %(resource)s %(name)s. Please refer to '
                     'admin guide and create one.'),
                   {'resource': resource, 'name': name})
开发者ID:afori,项目名称:neutron,代码行数:31,代码来源:n1kv_trunking_driver.py


示例11: create_project

    def create_project(self, org_name, part_name, dci_id, desc=None):
        """Create project on the DCNM.

        :param org_name: name of organization.
        :param part_name: name of partition.
        :param dci_id: Data Center interconnect id.
        :param desc: description of project.
        """
        desc = desc or org_name
        res = self._create_org(org_name, desc)
        if res and res.status_code in self._resp_ok:
            LOG.debug("Created %s organization in DCNM.", org_name)
        else:
            LOG.error(_LE("Failed to create %(org)s organization in DCNM."
                      "Response: %(res)s"), {'org': org_name, 'res': res})
            raise dexc.DfaClientRequestFailed(reason=res)

        res = self._create_or_update_partition(org_name, part_name,
                                               dci_id, desc)
        if res and res.status_code in self._resp_ok:
            LOG.debug("Created %s partition in DCNM.", part_name)
        else:
            LOG.error(_LE("Failed to create %(part)s partition in DCNM."
                      "Response: %(res)s"), {'part': part_name, 'res': res})
            raise dexc.DfaClientRequestFailed(reason=res)
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:25,代码来源:cisco_dfa_rest.py


示例12: process_uplink_event

 def process_uplink_event(self, msg, phy_uplink):
     LOG.info(_LI("Received New uplink Msg %(msg)s for uplink %(uplink)s"),
              {'msg': msg.get_status(), 'uplink': phy_uplink})
     if msg.get_status() == 'up':
         ovs_exc_raised = False
         try:
             self.ovs_vdp_obj_dict[phy_uplink] = ovs_vdp.OVSNeutronVdp(
                 phy_uplink, msg.get_integ_br(), msg.get_ext_br(),
                 msg.get_root_helper())
         except Exception as exc:
             LOG.error(_LE("OVS VDP Object creation failed %s"), str(exc))
             ovs_exc_raised = True
         if (ovs_exc_raised or not self.ovs_vdp_obj_dict[phy_uplink].
                 is_lldpad_setup_done()):
             # Is there a way to delete the object??
             LOG.error(_LE("UP Event Processing NOT Complete"))
             self.err_que.enqueue(constants.Q_UPL_PRIO, msg)
         else:
             self.uplink_det_compl = True
             veth_intf = (self.ovs_vdp_obj_dict[self.phy_uplink].
                          get_lldp_bridge_port())
             LOG.info(_LI("UP Event Processing Complete Saving uplink "
                          "%(ul)s and veth %(veth)s"),
                      {'ul': self.phy_uplink, 'veth': veth_intf})
             self.save_uplink(uplink=self.phy_uplink, veth_intf=veth_intf)
     elif msg.get_status() == 'down':
         # Free the object fixme(padkrish)
         if phy_uplink in self.ovs_vdp_obj_dict:
             self.ovs_vdp_obj_dict[phy_uplink].clear_obj_params()
         else:
             ovs_vdp.delete_uplink_and_flows(self.root_helper, self.br_ex,
                                             phy_uplink)
         self.save_uplink()
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:33,代码来源:dfa_vdp_mgr.py


示例13: _agent_registration

    def _agent_registration(self):
        """Register this agent with the server.

        This method registers the cfg agent with the neutron server so hosting
        devices can be assigned to it. In case the server is not ready to
        accept registration (it sends a False) then we retry registration
        for `MAX_REGISTRATION_ATTEMPTS` with a delay of
        `REGISTRATION_RETRY_DELAY`. If there is no server response or a
        failure to register after the required number of attempts,
        the agent stops itself.
        """
        for attempts in xrange(MAX_REGISTRATION_ATTEMPTS):
            context = n_context.get_admin_context_without_session()
            self.send_agent_report(self.agent_state, context)
            res = self.devmgr_rpc.register_for_duty(context)
            if res is True:
                LOG.info(_LI("[Agent registration] Agent successfully "
                           "registered"))
                return
            elif res is False:
                LOG.warning(_LW("[Agent registration] Neutron server said "
                                "that device manager was not ready. Retrying "
                                "in %0.2f seconds "), REGISTRATION_RETRY_DELAY)
                time.sleep(REGISTRATION_RETRY_DELAY)
            elif res is None:
                LOG.error(_LE("[Agent registration] Neutron server said that "
                              "no device manager was found. Cannot continue. "
                              "Exiting!"))
                raise SystemExit("Cfg Agent exiting")
        LOG.error(_LE("[Agent registration] %d unsuccessful registration "
                    "attempts. Exiting!"), MAX_REGISTRATION_ATTEMPTS)
        raise SystemExit("Cfg Agent exiting")
开发者ID:absolutarin,项目名称:neutron,代码行数:32,代码来源:cfg_agent.py


示例14: _delete_port_group

 def _delete_port_group(self, task):
     try:
         header, response = self.vcns.get_edge_id(task.userdata['job_id'])
     except exceptions.VcnsApiException:
         with excutils.save_and_reraise_exception():
             LOG.error(_LE("NSXv: Failed to get job for %s"),
                       task.userdata)
     status = response['status']
     if status != 'COMPLETED':
         if (status == 'QUEUED' or status == 'RUNNING' or
             status == 'ROLLBACK'):
             LOG.debug("NSXv: job is still pending for %s", task.userdata)
             return task_constants.TaskStatus.PENDING
     try:
         self.vcns.delete_port_group(
             task.userdata['dvs_id'],
             task.userdata['port_group_id'])
     except Exception as e:
         LOG.error(_LE('Unable to delete %(pg)s (job status %(state)s) '
                       'exception %(ex)s'),
                   {'pg': task.userdata['port_group_id'],
                    'state': status,
                    'ex': e})
     if status == 'FAILED':
         return task_constants.TaskStatus.ERROR
     return task_constants.TaskStatus.COMPLETED
开发者ID:wubala,项目名称:vmware-nsx,代码行数:26,代码来源:edge_appliance_driver.py


示例15: send_vdp_port_event

    def send_vdp_port_event(self, port_uuid, mac, net_uuid, segmentation_id, status, oui):
        """Send vNIC UP/Down event to VDP

        :param port_uuid: a ovslib.VifPort object.
        :mac: MAC address of the VNIC
        :param net_uuid: the net_uuid this port is to be associated with.
        :param segmentation_id: the VID for 'vlan' or tunnel ID for 'tunnel'
        :param status: Type of port event. 'up' or 'down'
        :oui: OUI Parameters
        """
        lldpad_port = self.lldpad_info
        if not lldpad_port:
            LOG.error(_LE("There is no LLDPad port available."))
            return False

        ret = False
        if status == "up":
            if self.vdp_mode == constants.VDP_SEGMENT_MODE:
                port_name = self.ext_br_obj.get_ofport_name(port_uuid)
                if port_name is None:
                    LOG.error(_LE("Unknown portname for uuid %s"), port_uuid)
                    return False
                LOG.info(_LI("portname for uuid %s is "), port_name)
                ret = self.port_up_segment_mode(lldpad_port, port_name, port_uuid, mac, net_uuid, segmentation_id, oui)
        else:
            if self.vdp_mode == constants.VDP_SEGMENT_MODE:
                ret = self.port_down_segment_mode(lldpad_port, port_uuid, mac, net_uuid, segmentation_id, oui)
        return ret
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:28,代码来源:ovs_vdp.py


示例16: serve_rpc

def serve_rpc():
    plugin = manager.NeutronManager.get_plugin()

    # If 0 < rpc_workers then start_rpc_listeners would be called in a
    # subprocess and we cannot simply catch the NotImplementedError.  It is
    # simpler to check this up front by testing whether the plugin supports
    # multiple RPC workers.
    if not plugin.rpc_workers_supported():
        LOG.debug("Active plugin doesn't implement start_rpc_listeners")
        if 0 < cfg.CONF.rpc_workers:
            LOG.error(_LE("'rpc_workers = %d' ignored because "
                          "start_rpc_listeners is not implemented."),
                      cfg.CONF.rpc_workers)
        raise NotImplementedError()

    try:
        rpc = RpcWorker(plugin)

        if cfg.CONF.rpc_workers < 1:
            rpc.start()
            return rpc
        else:
            launcher = common_service.ProcessLauncher(wait_interval=1.0)
            launcher.launch_service(rpc, workers=cfg.CONF.rpc_workers)
            return launcher
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception(_LE('Unrecoverable error: please check log for '
                              'details.'))
开发者ID:Intellifora,项目名称:neutron,代码行数:29,代码来源:service.py


示例17: _bind_port_level

    def _bind_port_level(self, context, level, segments_to_bind):
        binding = context._binding
        port_id = context.current['id']
        LOG.debug("Attempting to bind port %(port)s on host %(host)s "
                  "at level %(level)s using segments %(segments)s",
                  {'port': port_id,
                   'host': context.host,
                   'level': level,
                   'segments': segments_to_bind})

        if level == MAX_BINDING_LEVELS:
            LOG.error(_LE("Exceeded maximum binding levels attempting to bind "
                        "port %(port)s on host %(host)s"),
                      {'port': context.current['id'],
                       'host': context.host})
            return False

        for driver in self.ordered_mech_drivers:
            if not self._check_driver_to_bind(driver, segments_to_bind,
                                              context._binding_levels):
                continue
            try:
                context._prepare_to_bind(segments_to_bind)
                driver.obj.bind_port(context)
                segment = context._new_bound_segment
                if segment:
                    context._push_binding_level(
                        models.PortBindingLevel(port_id=port_id,
                                                host=context.host,
                                                level=level,
                                                driver=driver.name,
                                                segment_id=segment))
                    next_segments = context._next_segments_to_bind
                    if next_segments:
                        # Continue binding another level.
                        if self._bind_port_level(context, level + 1,
                                                 next_segments):
                            return True
                        else:
                            context._pop_binding_level()
                    else:
                        # Binding complete.
                        LOG.debug("Bound port: %(port)s, "
                                  "host: %(host)s, "
                                  "vif_type: %(vif_type)s, "
                                  "vif_details: %(vif_details)s, "
                                  "binding_levels: %(binding_levels)s",
                                  {'port': port_id,
                                   'host': context.host,
                                   'vif_type': binding.vif_type,
                                   'vif_details': binding.vif_details,
                                   'binding_levels': context.binding_levels})
                        return True
            except Exception:
                LOG.exception(_LE("Mechanism driver %s failed in "
                                  "bind_port"),
                              driver.name)
        LOG.error(_LE("Failed to bind port %(port)s on host %(host)s"),
                  {'port': context.current['id'],
                   'host': binding.host})
开发者ID:rajamony,项目名称:neutron,代码行数:60,代码来源:managers.py


示例18: _validate_multicast_ip_range

    def _validate_multicast_ip_range(self, network_profile):
        """
        Validate multicast ip range values.

        :param network_profile: network profile object
        """
        try:
            min_ip, max_ip = (network_profile
                              ['multicast_ip_range'].split('-', 1))
        except ValueError:
            msg = _LE("Invalid multicast ip address range. "
                      "example range: 224.1.1.1-224.1.1.10")
            LOG.error(msg)
            raise n_exc.InvalidInput(error_message=msg)
        for ip in [min_ip, max_ip]:
            try:
                if not netaddr.IPAddress(ip).is_multicast():
                    msg = _LE("%s is not a valid multicast ip address") % ip
                    LOG.error(msg)
                    raise n_exc.InvalidInput(error_message=msg)
                if netaddr.IPAddress(ip) <= netaddr.IPAddress('224.0.0.255'):
                    msg = _LE("%s is reserved multicast ip address") % ip
                    LOG.error(msg)
                    raise n_exc.InvalidInput(error_message=msg)
            except netaddr.AddrFormatError:
                msg = _LE("%s is not a valid ip address") % ip
                LOG.error(msg)
                raise n_exc.InvalidInput(error_message=msg)
        if netaddr.IPAddress(min_ip) > netaddr.IPAddress(max_ip):
            msg = (_LE("Invalid multicast IP range '%(min_ip)s-%(max_ip)s':"
                       " Range should be from low address to high address")
                   % {'min_ip': min_ip, 'max_ip': max_ip})
            LOG.error(msg)
            raise n_exc.InvalidInput(error_message=msg)
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:34,代码来源:network_profile_service.py


示例19: process_update_network

    def process_update_network(self, context, data, result):
        """Implementation of abstract method from ExtensionDriver class."""
    	LOG.debug("RK: process_update_network().  data: %s" , data)

        net_id = result.get('id')
	net_min_attr = data.get(rk_const.RK_MIN_RATE)
	net_max_attr = data.get(rk_const.RK_MAX_RATE)

    	LOG.debug("RK: update_network: %s and %s", net_min_attr, net_max_attr)
        if attributes.is_attr_set(net_min_attr) and \
               attributes.is_attr_set(net_max_attr):

            with context.session.begin(subtransactions=True):
                try:
                    res = rk_db.get_vnet_profile(net_id, context.session)

		    if res:
           	        rk_db.update_vnet_rate_limit(net_id, net_min_attr, net_max_attr, context.session)

		    else:
                        # Network not found and can't be updated.  Create instead
		        try:
                    	    rk_db.create_vnet_record(net_id, net_min_attr, net_max_attr, context.session)
            	        except Exception as e:
                	    LOG.error(_LE("RK: update_network: error %s" % e)) 
                	    raise ml2_exc.MechanismDriverError()

    		    LOG.debug("RK: update_network: res: %s", res)

		except Exception as a:
                    LOG.error(_LE("RK: update_network: error %s" % a))
                    raise ml2_exc.MechanismDriverError()
开发者ID:HewlettPackard,项目名称:ratekeeper-neutron-ml2-plugin,代码行数:32,代码来源:ratekeeper_ext_driver.py


示例20: _status_edge

 def _status_edge(self, task):
     edge_id = task.userdata['edge_id']
     try:
         response = self.vcns.get_edge_deploy_status(edge_id)[1]
         task.userdata['retries'] = 0
         system_status = response.get('systemStatus', None)
         if system_status is None:
             status = constants.TaskStatus.PENDING
         elif system_status == 'good':
             status = constants.TaskStatus.COMPLETED
         else:
             status = constants.TaskStatus.ERROR
     except exceptions.VcnsApiException:
         with excutils.save_and_reraise_exception():
             LOG.exception(_LE("VCNS: Edge %s status query failed."),
                           edge_id)
     except Exception:
         retries = task.userdata.get('retries', 0) + 1
         if retries < 3:
             task.userdata['retries'] = retries
             LOG.exception(_LE("VCNS: Unable to retrieve edge %(edge_id)s "
                               "status. Retry %(retries)d."),
                           {'edge_id': edge_id,
                            'retries': retries})
             status = constants.TaskStatus.PENDING
         else:
             LOG.exception(_LE("VCNS: Unable to retrieve edge %s status. "
                              "Abort."), edge_id)
             status = constants.TaskStatus.ERROR
     LOG.debug("VCNS: Edge %s status", edge_id)
     return status
开发者ID:CiscoSystems,项目名称:neutron,代码行数:31,代码来源:edge_appliance_driver.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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