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

Python importutils.import_object函数代码示例

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

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



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

示例1: __init__

 def __init__(self, configfile=None):
     self.extra_binding_dict = {
         portbindings.VIF_TYPE: portbindings.VIF_TYPE_OVS,
         portbindings.CAPABILITIES: {
             portbindings.CAP_PORT_FILTER:
             'security-group' in self.supported_extension_aliases}}
     ovs_db_v2.initialize()
     self._parse_network_vlan_ranges()
     ovs_db_v2.sync_vlan_allocations(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.OVS.tenant_network_type
     if self.tenant_network_type not in [constants.TYPE_LOCAL,
                                         constants.TYPE_VLAN,
                                         constants.TYPE_GRE,
                                         constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. "
                   "Agent terminated!"),
                   self.tenant_network_type)
         sys.exit(1)
     self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
     self.tunnel_id_ranges = []
     if self.enable_tunneling:
         self._parse_tunnel_id_ranges()
         ovs_db_v2.sync_tunnel_allocations(self.tunnel_id_ranges)
     elif self.tenant_network_type == constants.TYPE_GRE:
         LOG.error(_("Tunneling disabled but tenant_network_type is 'gre'. "
                   "Agent terminated!"))
         sys.exit(1)
     self.setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver)
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver)
开发者ID:alanmeadows,项目名称:quantum,代码行数:32,代码来源:ovs_quantum_plugin.py


示例2: __init__

    def __init__(self, conf):
        self.conf = conf
        try:
            vif_driver = importutils.import_object(conf.interface_driver, conf)
        except ImportError:
            # the driver is optional
            msg = _('Error importing interface driver: %s')
            raise SystemExit(msg % conf.interface_driver)
            vif_driver = None

        try:
            self.driver = importutils.import_object(
                conf.device_driver,
                config.get_root_helper(self.conf),
                conf.loadbalancer_state_path,
                vif_driver,
                self._vip_plug_callback
            )
        except ImportError:
            msg = _('Error importing loadbalancer device driver: %s')
            raise SystemExit(msg % conf.device_driver)
        ctx = context.get_admin_context_without_session()
        self.plugin_rpc = agent_api.LbaasAgentApi(
            plugin_driver.TOPIC_PROCESS_ON_HOST,
            ctx,
            conf.host
        )
        self.needs_resync = False
        self.cache = LogicalDeviceCache()
开发者ID:DestinyOneSystems,项目名称:quantum,代码行数:29,代码来源:agent_manager.py


示例3: __init__

    def __init__(self):
        """
        Initialize the segmentation manager, check which device plugins are
        configured, and load the inventories those device plugins for which the
        inventory is configured
        """
        for key in conf.PLUGINS[const.PLUGINS].keys():
            plugin_obj = conf.PLUGINS[const.PLUGINS][key]
            self._plugins[key] = importutils.import_object(plugin_obj)
            LOG.debug(_("Loaded device plugin %s\n"),
                      conf.PLUGINS[const.PLUGINS][key])
            if key in conf.PLUGINS[const.INVENTORY].keys():
                inventory_obj = conf.PLUGINS[const.INVENTORY][key]
                self._inventory[key] = importutils.import_object(inventory_obj)
                LOG.debug(_("Loaded device inventory %s\n"),
                          conf.PLUGINS[const.INVENTORY][key])

        if ((const.VSWITCH_PLUGIN in self._plugins) and
            hasattr(self._plugins[const.VSWITCH_PLUGIN],
                    "supported_extension_aliases")):
            self.supported_extension_aliases.extend(
                self._plugins[const.VSWITCH_PLUGIN].
                supported_extension_aliases)

        # At this point, all the database models should have been loaded. It's
        # possible that configure_db() may have been called by one of the
        # plugins loaded in above. Otherwise, this call is to make sure that
        # the database is initialized
        db_api.configure_db()

        # Initialize credential store after database initialization
        cred.Store.initialize()
        LOG.debug(_("%(module)s.%(name)s init done"),
                  {'module': __name__,
                   'name': self.__class__.__name__})
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:35,代码来源:virt_phy_sw_v2.py


示例4: __init__

 def __init__(self, configfile=None):
     ovs_db_v2.initialize()
     self._parse_network_vlan_ranges()
     ovs_db_v2.sync_vlan_allocations(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.OVS.tenant_network_type
     if self.tenant_network_type not in [constants.TYPE_LOCAL,
                                         constants.TYPE_VLAN,
                                         constants.TYPE_GRE,
                                         constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. "
                   "Agent terminated!"),
                   self.tenant_network_type)
         sys.exit(1)
     self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
     self.tunnel_id_ranges = []
     if self.enable_tunneling:
         self._parse_tunnel_id_ranges()
         ovs_db_v2.sync_tunnel_allocations(self.tunnel_id_ranges)
     elif self.tenant_network_type == constants.TYPE_GRE:
         LOG.error(_("Tunneling disabled but tenant_network_type is 'gre'. "
                   "Agent terminated!"))
         sys.exit(1)
     self.setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver)
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver)
开发者ID:SangBaisong,项目名称:quantum,代码行数:27,代码来源:ovs_quantum_plugin.py


示例5: __init__

    def __init__(self):
        """
        Initialize the segmentation manager, check which device plugins are
        configured, and load the inventories those device plugins for which the
        inventory is configured
        """
        cdb.initialize()
        cred.Store.initialize()
        for key in conf.PLUGINS[const.PLUGINS].keys():
            plugin_obj = conf.PLUGINS[const.PLUGINS][key]
            self._plugins[key] = importutils.import_object(plugin_obj)
            LOG.debug(_("Loaded device plugin %s\n"),
                      conf.PLUGINS[const.PLUGINS][key])
            if key in conf.PLUGINS[const.INVENTORY].keys():
                inventory_obj = conf.PLUGINS[const.INVENTORY][key]
                self._inventory[key] = importutils.import_object(inventory_obj)
                LOG.debug(_("Loaded device inventory %s\n"),
                          conf.PLUGINS[const.INVENTORY][key])

        if hasattr(self._plugins[const.VSWITCH_PLUGIN],
                   "supported_extension_aliases"):
            self.supported_extension_aliases.extend(
                self._plugins[const.VSWITCH_PLUGIN].
                supported_extension_aliases)

        LOG.debug(_("%(module)s.%(name)s init done"),
                  {'module': __name__,
                   'name': self.__class__.__name__})
开发者ID:ayushjain1310,项目名称:quantum,代码行数:28,代码来源:virt_phy_sw_v2.py


示例6: __init__

 def __init__(self):
     for key in conf.PLUGINS[const.PLUGINS].keys():
         plugin_obj = conf.PLUGINS[const.PLUGINS][key]
         self._plugins[key] = importutils.import_object(plugin_obj)
         LOG.debug("Loaded device plugin %s\n" %
                   conf.PLUGINS[const.PLUGINS][key])
         if key in conf.PLUGINS[const.INVENTORY].keys():
             inventory_obj = conf.PLUGINS[const.INVENTORY][key]
             self._inventory[key] = importutils.import_object(inventory_obj)
             LOG.debug("Loaded device inventory %s\n" %
                       conf.PLUGINS[const.INVENTORY][key])
开发者ID:Blackspan,项目名称:quantum,代码行数:11,代码来源:l2network_single_blade.py


示例7: __init__

 def __init__(self):
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.VLANS.tenant_network_type
     if self.tenant_network_type not in [constants.TYPE_LOCAL, constants.TYPE_VLAN, constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. " "Service terminated!"), self.tenant_network_type)
         sys.exit(1)
     self._setup_rpc()
     self.network_scheduler = importutils.import_object(cfg.CONF.network_scheduler_driver)
     self.router_scheduler = importutils.import_object(cfg.CONF.router_scheduler_driver)
     LOG.debug(_("Linux Bridge Plugin initialization complete"))
开发者ID:emagana,项目名称:quantum,代码行数:12,代码来源:lb_quantum_plugin.py


示例8: __init__

    def __init__(self):
        cdb.initialize()
        cred.Store.initialize()
        self._model = importutils.import_object(conf.MODEL_CLASS)
        self._vlan_mgr = importutils.import_object(conf.MANAGER_CLASS)
        """
        Changes for configure_db accordingly will be done later
        """

        sql_connection = "mysql://%s:%[email protected]%s/%s" % (conf.DB_USER,
                          conf.DB_PASS, conf.DB_HOST, conf.DB_NAME)
        db.configure_db({'sql_connection': sql_connection,
                         'base': models_v2.model_base.BASEV2})
        LOG.debug("L2Network plugin initialization done successfully\n")
开发者ID:harspras,项目名称:openstack-catalyst,代码行数:14,代码来源:l2network_plugin_v2.py


示例9: __init__

 def __init__(self, conf, db, device_owner=""):
     self.conf = conf
     self.db = db
     self.device_owner = device_owner
     if not conf.interface_driver:
         LOG.error(_("You must specify an interface driver"))
     self.driver = importutils.import_object(conf.interface_driver, conf)
开发者ID:t-lin,项目名称:quantum,代码行数:7,代码来源:dhcp_agent.py


示例10: __init__

    def __init__(self, conf, db):
        self.conf = conf
        self.db = db

        if not conf.interface_driver:
            LOG.error(_('You must specify an interface driver'))
        self.driver = importutils.import_object(conf.interface_driver, conf)
开发者ID:vbannai,项目名称:quantum,代码行数:7,代码来源:dhcp_agent.py


示例11: mocked_brocade_init

        def mocked_brocade_init(self):

            self._switch = {'address': FAKE_IPADDRESS,
                            'username': FAKE_USERNAME,
                            'password': FAKE_PASSWORD
                            }
            self._driver = importutils.import_object(NOS_DRIVER)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:7,代码来源:test_brocade_plugin.py


示例12: _load_drivers

    def _load_drivers(self):
        self.drivers = {}
        drivers = cfg.CONF.service_drivers
        LOG.debug(_('Configured service drivers: "%s"'), drivers)

        for driver in drivers:
            try:
                LOG.debug(_('Loading service driver "%s"'), driver)
                driver_inst = importutils.import_object(driver)
            except ImportError:
                LOG.error(_('Error loading driver "%s"'), driver)
                raise DriverNotFound(driver_name=driver)

            service_type = driver_inst.get_service_type()
            driver_type = driver_inst.get_type()
            version = driver_inst.get_version()
            identity = (service_type, driver_type, version)

            # restrict multiple implementations of the same type and version
            if identity in self.drivers:
                raise DuplicateDriver(service_type=service_type,
                                      driver_type=driver_type, version=version)

            self.drivers[identity] = driver_inst
            LOG.info(_('Service driver "%(driver)s" loaded successfully. '
                       'Driver identity is "%(identity)s"'),
                     {'driver': driver, 'identity': ':'.join(identity)})
开发者ID:kumarcv,项目名称:openstack-nf,代码行数:27,代码来源:driver_manager.py


示例13: __init__

 def __init__(self, conf, plugin):
     self.conf = conf
     self.root_helper = config.get_root_helper(conf)
     self.plugin = plugin
     if not conf.interface_driver:
         LOG.error(_("You must specify an interface driver"))
     self.driver = importutils.import_object(conf.interface_driver, conf)
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:7,代码来源:dhcp_agent.py


示例14: __init__

    def __init__(self, conf):
        self.conf = conf
        self.router_info = {}

        if not conf.interface_driver:
            LOG.error(_('You must specify an interface driver'))
            sys.exit(1)
        try:
            self.driver = importutils.import_object(conf.interface_driver,
                                                    conf)
        except:
            LOG.exception(_("Error importing interface driver '%s'"
                            % conf.interface_driver))
            sys.exit(1)

        self.polling_interval = conf.polling_interval

        self.qclient = client.Client(
            username=self.conf.admin_user,
            password=self.conf.admin_password,
            tenant_name=self.conf.admin_tenant_name,
            auth_url=self.conf.auth_url,
            auth_strategy=self.conf.auth_strategy,
            auth_region=self.conf.auth_region
        )

        if self.conf.use_namespaces:
            self._destroy_all_router_namespaces()
开发者ID:Blackspan,项目名称:quantum,代码行数:28,代码来源:l3_agent.py


示例15: new_nexus_init

 def new_nexus_init(self):
     self._client = importutils.import_object(NEXUS_DRIVER)
     self._nexus_ip = NEXUS_IP_ADDRESS
     self._nexus_username = NEXUS_USERNAME
     self._nexus_password = NEXUS_PASSWORD
     self._nexus_ports = NEXUS_PORTS
     self._nexus_ssh_port = NEXUS_SSH_PORT
开发者ID:wph540,项目名称:quantum,代码行数:7,代码来源:test_nexus_plugin.py


示例16: __init__

    def __init__(self, conf):
        self.conf = conf
        self.router_info = {}

        if not conf.interface_driver:
            LOG.error(_('You must specify an interface driver'))
            sys.exit(1)
        try:
            self.driver = importutils.import_object(conf.interface_driver,
                                                    conf)
        except:
            LOG.exception(_("Error importing interface driver '%s'"
                            % conf.interface_driver))
            sys.exit(1)

        self.polling_interval = conf.polling_interval

        if (self.conf.external_network_bridge and
            not ip_lib.device_exists(self.conf.external_network_bridge)):
            raise Exception("external network bridge '%s' does not exist"
                            % self.conf.external_network_bridge)

        self.qclient = client.Client(
            username=self.conf.admin_user,
            password=self.conf.admin_password,
            tenant_name=self.conf.admin_tenant_name,
            auth_url=self.conf.auth_url,
            auth_strategy=self.conf.auth_strategy,
            auth_region=self.conf.auth_region
        )

        self._destroy_all_router_namespaces()
开发者ID:psiwczak,项目名称:quantum,代码行数:32,代码来源:l3_agent.py


示例17: __init__

    def __init__(self, host, conf=None):
        if conf:
            self.conf = conf
        else:
            self.conf = cfg.CONF
        self.root_helper = config.get_root_helper(self.conf)
        self.router_info = {}

        if not self.conf.interface_driver:
            raise SystemExit(_('An interface driver must be specified'))
        try:
            self.driver = importutils.import_object(self.conf.interface_driver,
                                                    self.conf)
        except:
            msg = _("Error importing interface driver "
                    "'%s'") % self.conf.interface_driver
            raise SystemExit(msg)

        self.context = context.get_admin_context_without_session()
        self.plugin_rpc = L3PluginApi(topics.PLUGIN, host)
        self.fullsync = True
        self.sync_sem = semaphore.Semaphore(1)
        if self.conf.use_namespaces:
            self._destroy_router_namespaces(self.conf.router_id)
        super(L3NATAgent, self).__init__(host=self.conf.host)
开发者ID:Frostman,项目名称:quantum,代码行数:25,代码来源:l3_agent.py


示例18: __init__

    def __init__(self):
        """
        Initialize the segmentation manager, check which device plugins are
        configured, and load the inventories those device plugins for which the
        inventory is configured
        """
        self._vlan_mgr = importutils.import_object(conf.MANAGER_CLASS)
        for key in conf.PLUGINS[const.PLUGINS].keys():
            plugin_obj = conf.PLUGINS[const.PLUGINS][key]
            self._plugins[key] = importutils.import_object(plugin_obj)
            LOG.debug("Loaded device plugin %s\n" % conf.PLUGINS[const.PLUGINS][key])
            if key in conf.PLUGINS[const.INVENTORY].keys():
                inventory_obj = conf.PLUGINS[const.INVENTORY][key]
                self._inventory[key] = importutils.import_object(inventory_obj)
                LOG.debug("Loaded device inventory %s\n" % conf.PLUGINS[const.INVENTORY][key])

        LOG.debug("%s.%s init done" % (__name__, self.__class__.__name__))
开发者ID:vbannai,项目名称:quantum,代码行数:17,代码来源:network_multi_blade_v2.py


示例19: __init__

    def __init__(self):
        ndb.initialize()
        self.ofc = ofc_manager.OFCManager()

        self.packet_filter_enabled = config.OFC.enable_packet_filter and self.ofc.driver.filter_supported()
        if self.packet_filter_enabled:
            self.supported_extension_aliases.append("PacketFilters")

        # Set the plugin default extension path
        # if no api_extensions_path is specified.
        if not config.CONF.api_extensions_path:
            config.CONF.set_override("api_extensions_path", "quantum/plugins/nec/extensions")

        self.setup_rpc()

        self.network_scheduler = importutils.import_object(config.CONF.network_scheduler_driver)
        self.router_scheduler = importutils.import_object(config.CONF.router_scheduler_driver)
开发者ID:Apsu,项目名称:quantum,代码行数:17,代码来源:nec_plugin.py


示例20: brocade_init

    def brocade_init(self):
        """Brocade specific initialization."""

        self._switch = {'address': cfg.CONF.SWITCH.address,
                        'username': cfg.CONF.SWITCH.username,
                        'password': cfg.CONF.SWITCH.password
                        }
        self._driver = importutils.import_object(NOS_DRIVER)
开发者ID:wdec,项目名称:quantum,代码行数:8,代码来源:QuantumPlugin.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python jsonutils.dumps函数代码示例发布时间:2022-05-26
下一篇:
Python importutils.import_class函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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