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


Python config.get函数代码示例

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


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

示例1: __init__

 def __init__(self, name=None):
     self._name = name or config.get(
         'containers', 'network_name')
     self._gw = config.get('containers', 'network_gateway')
     self._nic = config.get('containers', 'network_interface')
     self._subnet = config.get('containers', 'network_subnet')
     self._mask = config.getint('containers', 'network_mask')
     self._existing = False
开发者ID:EdDev,项目名称:vdsm,代码行数:8,代码来源:docker.py

示例2: _loadBindingJsonRpc

 def _loadBindingJsonRpc(self):
     from BindingJsonRpc import BindingJsonRpc
     from Bridge import DynamicBridge
     ip = config.get('addresses', 'management_ip')
     port = config.getint('addresses', 'json_port')
     truststore_path = None
     if config.getboolean('vars', 'ssl'):
         truststore_path = config.get('vars', 'trust_store_path')
     conf = [('tcp', {"ip": ip, "port": port})]
     self.bindings['json'] = BindingJsonRpc(DynamicBridge(), conf,
                                            truststore_path)
开发者ID:humblec,项目名称:vdsm,代码行数:11,代码来源:clientIF.py

示例3: _createSSLContext

 def _createSSLContext(self):
     sslctx = None
     if config.getboolean('vars', 'ssl'):
         truststore_path = config.get('vars', 'trust_store_path')
         key_file = os.path.join(truststore_path, 'keys', 'vdsmkey.pem')
         cert_file = os.path.join(truststore_path, 'certs', 'vdsmcert.pem')
         ca_cert = os.path.join(truststore_path, 'certs', 'cacert.pem')
         protocol = config.get('vars', 'ssl_protocol')
         sslctx = SSLContext(cert_file, key_file, ca_cert=ca_cert,
                             protocol=protocol)
     return sslctx
开发者ID:fonlabs,项目名称:vdsm,代码行数:11,代码来源:clientIF.py

示例4: _prepareBindings

 def _prepareBindings(self):
     self.bindings = {}
     xmlrpc_params = {
         'ip': config.get('addresses', 'management_ip'),
         'port': config.get('addresses', 'management_port'),
         'ssl': config.getboolean('vars', 'ssl'),
         'vds_responsiveness_timeout':
             config.getint('vars', 'vds_responsiveness_timeout'),
         'trust_store_path': config.get('vars', 'trust_store_path'),
         'default_bridge': config.get("vars", "default_bridge"), }
     self.bindings['xmlrpc'] = BindingXMLRPC(self, self.log, xmlrpc_params)
开发者ID:ekohl,项目名称:vdsm,代码行数:11,代码来源:clientIF.py

示例5: start

 def start(self):
     if _JSONRPC_ENABLED:
         requestQueues = config.get('addresses', 'request_queues')
         requestQueue = requestQueues.split(",")[0]
         self.vdscli = jsonrpcvdscli.connect(requestQueue, xml_compat=False)
     else:
         self.vdscli = vdscli.connect()
     self.netinfo = self._get_netinfo()
     if config.get('vars', 'net_persistence') == 'unified':
         self.config = RunningConfig()
     else:
         self.config = None
开发者ID:mykaul,项目名称:vdsm,代码行数:12,代码来源:utils.py

示例6: _loadBindingXMLRPC

 def _loadBindingXMLRPC(self):
     from BindingXMLRPC import BindingXMLRPC
     ip = config.get('addresses', 'management_ip')
     xmlrpc_port = config.get('addresses', 'management_port')
     use_ssl = config.getboolean('vars', 'ssl')
     resp_timeout = config.getint('vars', 'vds_responsiveness_timeout')
     truststore_path = config.get('vars', 'trust_store_path')
     default_bridge = config.get("vars", "default_bridge")
     self.bindings['xmlrpc'] = BindingXMLRPC(self, self.log, ip,
                                             xmlrpc_port, use_ssl,
                                             resp_timeout, truststore_path,
                                             default_bridge)
开发者ID:therealmik,项目名称:vdsm,代码行数:12,代码来源:clientIF.py

示例7: start

def start():
    """ Starts application wide CPU profiling """
    global _profiler
    if is_enabled():
        with _lock:
            if _profiler:
                raise UsageError('CPU profiler is already running')
            _profiler = Profiler(
                config.get('devel', 'cpu_profile_filename'),
                format=config.get('devel', 'cpu_profile_format'),
                clock=config.get('devel', 'cpu_profile_clock'),
                builtins=config.getboolean('devel', 'cpu_profile_builtins'),
                threads=True)
            _profiler.start()
开发者ID:EdDev,项目名称:vdsm,代码行数:14,代码来源:cpu.py

示例8: __init__

 def __init__(self, net_info, inRollback=False):
     is_unipersistence = config.get('vars', 'net_persistence') == 'unified'
     super(Ifcfg, self).__init__(ConfigWriter(),
                                 net_info,
                                 is_unipersistence,
                                 inRollback)
     self.runningConfig = RunningConfig()
开发者ID:EdDev,项目名称:vdsm,代码行数:7,代码来源:ifcfg.py

示例9: start

 def start(self):
     self.vdscli = vdscli.connect()
     self.netinfo = self._get_netinfo()
     if config.get("vars", "net_persistence") == "unified":
         self.config = RunningConfig()
     else:
         self.config = None
开发者ID:kvaps,项目名称:vdsm,代码行数:7,代码来源:utils.py

示例10: _send_notification

 def _send_notification(self, message):
     try:
         self.bindings['jsonrpc'].reactor.server.send(
             message, config.get('addresses', 'event_queue'))
     except KeyError:
         self.log.warning("Attempt to send an event when jsonrpc binding"
                          " not available")
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:7,代码来源:clientIF.py

示例11: _setupVdsConnection

    def _setupVdsConnection(self):
        if self.hibernating:
            return

        hostPort = vdscli.cannonizeHostPort(
            self._dst,
            config.getint('addresses', 'management_port'))
        self.remoteHost, port = hostPort.rsplit(':', 1)

        try:
            client = self._createClient(port)
            requestQueues = config.get('addresses', 'request_queues')
            requestQueue = requestQueues.split(",")[0]
            self._destServer = jsonrpcvdscli.connect(requestQueue, client)
            self.log.debug('Initiating connection with destination')
            self._destServer.ping()

        except (JsonRpcBindingsError, JsonRpcNoResponseError):
            if config.getboolean('vars', 'ssl'):
                self._destServer = vdscli.connect(
                    hostPort,
                    useSSL=True,
                    TransportClass=kaxmlrpclib.TcpkeepSafeTransport)
            else:
                self._destServer = kaxmlrpclib.Server('http://' + hostPort)

        self.log.debug('Destination server is: ' + hostPort)
开发者ID:mykaul,项目名称:vdsm,代码行数:27,代码来源:migration.py

示例12: __init__

 def __init__(self, vm, dst='', dstparams='',
              mode=MODE_REMOTE, method=METHOD_ONLINE,
              tunneled=False, dstqemu='', abortOnError=False,
              compressed=False, autoConverge=False, **kwargs):
     self.log = vm.log
     self._vm = vm
     self._dst = dst
     self._mode = mode
     if method != METHOD_ONLINE:
         self.log.warning(
             'migration method %s is deprecated, forced to "online"',
             method)
     self._dstparams = dstparams
     self._machineParams = {}
     self._tunneled = utils.tobool(tunneled)
     self._abortOnError = utils.tobool(abortOnError)
     self._dstqemu = dstqemu
     self._downtime = kwargs.get('downtime') or \
         config.get('vars', 'migration_downtime')
     self._autoConverge = autoConverge
     self._compressed = compressed
     self.status = {
         'status': {
             'code': 0,
             'message': 'Migration in progress'}}
     self._progress = 0
     threading.Thread.__init__(self)
     self._preparingMigrationEvt = True
     self._migrationCanceledEvt = False
     self._monitorThread = None
开发者ID:txomon,项目名称:vdsm,代码行数:30,代码来源:migration.py

示例13: _setupVdsConnection

    def _setupVdsConnection(self):
        if self.hibernating:
            return

        # FIXME: The port will depend on the binding being used.
        # This assumes xmlrpc
        hostPort = vdscli.cannonizeHostPort(
            self._dst,
            config.get('addresses', 'management_port'))
        self.remoteHost, _ = hostPort.rsplit(':', 1)

        if config.getboolean('vars', 'ssl'):
            self.destServer = vdscli.connect(
                hostPort,
                useSSL=True,
                TransportClass=kaxmlrpclib.TcpkeepSafeTransport)
        else:
            self.destServer = kaxmlrpclib.Server('http://' + hostPort)
        self.log.debug('Destination server is: ' + hostPort)
        try:
            self.log.debug('Initiating connection with destination')
            status = self.destServer.getVmStats(self._vm.id)
            if not status['status']['code']:
                self.log.error("Machine already exists on the destination")
                self.status = errCode['exist']
        except Exception:
            self.log.error("Error initiating connection", exc_info=True)
            self.status = errCode['noConPeer']
开发者ID:mpavlase,项目名称:vdsm,代码行数:28,代码来源:migration.py

示例14: __init__

 def __init__(self, configApplier):
     self.configApplier = configApplier
     self._libvirtAdded = set()
     self.unifiedPersistence = \
         config.get('vars', 'persistence') == 'unified'
     if self.unifiedPersistence:
         self.runningConfig = RunningConfig()
开发者ID:mydaisy2,项目名称:vdsm,代码行数:7,代码来源:__init__.py

示例15: wrapped

    def wrapped(*args, **kwargs):
        if not config.get('vars', 'net_persistence') == 'unified':
            return func(*args, **kwargs)

        # Get args and kwargs in a single dictionary
        attrs = kwargs.copy()
        attrs.update(dict(zip(spec.args, args)))

        isolatedCommand = attrs.get('configurator') is None
        # Detect if we are running an isolated command, i.e., a command that is
        # not called as part of composed API operation like setupNetworks or
        # editNetwork, but rather as its own API verb. This is necessary in
        # order to maintain behavior of the addNetwork and delNetwork API verbs
        if isolatedCommand:
            attrs['configurator'] = configurator = ConfiguratorClass()
            configurator.begin()
        else:
            configurator = attrs['configurator']

        ret = func(**attrs)

        nics = attrs.pop('nics', None)
        # Bond config handled in configurator so that operations only touching
        # bonds don't need special casing and the logic of this remains simpler
        if not attrs.get('bonding'):
            if nics:
                attrs['nic'], = nics

        if func.__name__ == 'delNetwork':
            configurator.runningConfig.removeNetwork(attrs.pop('network'))
        else:
            configurator.runningConfig.setNetwork(attrs.pop('network'), attrs)
        if isolatedCommand:  # Commit the no-rollback transaction.
            configurator.commit()
        return ret
开发者ID:int64ago-public,项目名称:vdsm,代码行数:35,代码来源:configNetwork.py


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