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


Python Config.hostname方法代码示例

本文整理汇总了Python中cattle.Config.hostname方法的典型用法代码示例。如果您正苦于以下问题:Python Config.hostname方法的具体用法?Python Config.hostname怎么用?Python Config.hostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cattle.Config的用法示例。


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

示例1: _add_resources

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import hostname [as 别名]
    def _add_resources(self, ping, pong):
        if not utils.ping_include_resources(ping):
            return

        physical_host = Config.physical_host()

        compute = {
            'type': 'host',
            'kind': LIBVIRT_KIND,
            'name': Config.hostname() + '/libvirt',
            'uuid': LibvirtConfig.libvirt_uuid(),
            'physicalHostUuid': physical_host['uuid'],
            'data': {
                'libvirt': {
                    'type': self.get_default_type()
                }
            }
        }

        resources = [physical_host, compute]

        for driver in pool_drivers():
            for pool in driver.discover(compute):
                data = utils.get_map_value(pool, 'data', 'libvirt')
                data['driver'] = driver.driver_name()

                resources.append(pool)

        utils.ping_add_resources(pong, *resources)
开发者ID:assimilator101,项目名称:cattle,代码行数:31,代码来源:compute.py

示例2: _add_resources

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import hostname [as 别名]
    def _add_resources(self, ping, pong):
        if not utils.ping_include_resources(ping):
            return

        stats = None
        if utils.ping_include_stats(ping):
            try:
                stats = self.host_info.collect_data()
            except:
                log.exception("Error getting host info stats")

        physical_host = Config.physical_host()

        compute = {
            'type': 'host',
            'kind': 'docker',
            'name': Config.hostname(),
            'createLabels': self._get_host_create_labels(),
            'labels': self._get_host_labels(),
            'physicalHostUuid': physical_host['uuid'],
            'uuid': DockerConfig.docker_uuid(),
            'info': stats
        }

        pool = {
            'type': 'storagePool',
            'kind': 'docker',
            'name': compute['name'] + ' Storage Pool',
            'hostUuid': compute['uuid'],
            'uuid': compute['uuid'] + '-pool'
        }

        resolved_ip = socket.gethostbyname(DockerConfig.docker_host_ip())

        ip = {
            'type': 'ipAddress',
            'uuid': resolved_ip,
            'address': resolved_ip,
            'hostUuid': compute['uuid'],
        }

        proxy = Config.host_proxy()
        if proxy is not None:
            compute['apiProxy'] = proxy

        utils.ping_add_resources(pong, physical_host, compute, pool, ip)
开发者ID:cjellick,项目名称:python-agent,代码行数:48,代码来源:compute.py

示例3: ping_post_process

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import hostname [as 别名]
def ping_post_process(req, resp):
        hostname = Config.hostname()
        pool_name = hostname + ' Storage Pool'
        resources = resp['data']['resources']

        uuid = 'c861f990-4472-4fa1-960f-65171b544c28'
        instances = filter(lambda x: x['type'] == 'instance' and
                           x['uuid'] == uuid, resources)
        assert len(instances) == 1

        resources = filter(lambda x: x.get('kind') == 'docker', resources)
        resources.append(instances[0])

        resp['data']['resources'] = resources

        assert resp['data']['resources'][0]['name'] == hostname
        assert resp['data']['resources'][1]['name'] == pool_name
        resp['data']['resources'][0]['name'] = 'localhost'
        resp['data']['resources'][1]['name'] = 'localhost Storage Pool'
开发者ID:cloudnautique,项目名称:python-agent,代码行数:21,代码来源:test_docker.py

示例4: _add_resources

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import hostname [as 别名]
    def _add_resources(self, ping, pong):
        if not utils.ping_include_resources(ping):
            return

        stats = None
        if utils.ping_include_stats(ping):
            try:
                stats = self.host_info.collect_data()
            except:
                log.exception("Error geting host info stats")

        physical_host = Config.physical_host()

        compute = {
            "type": "host",
            "kind": "docker",
            "name": Config.hostname(),
            "labels": Config.labels(),
            "physicalHostUuid": physical_host["uuid"],
            "uuid": DockerConfig.docker_uuid(),
            "info": stats,
        }

        pool = {
            "type": "storagePool",
            "kind": "docker",
            "name": compute["name"] + " Storage Pool",
            "hostUuid": compute["uuid"],
            "uuid": compute["uuid"] + "-pool",
        }

        ip = {
            "type": "ipAddress",
            "uuid": DockerConfig.docker_host_ip(),
            "address": DockerConfig.docker_host_ip(),
            "hostUuid": compute["uuid"],
        }

        proxy = Config.host_proxy()
        if proxy is not None:
            compute["apiProxy"] = proxy

        utils.ping_add_resources(pong, physical_host, compute, pool, ip)
开发者ID:dx9,项目名称:python-agent,代码行数:45,代码来源:compute.py

示例5: _add_resources

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import hostname [as 别名]
    def _add_resources(self, ping, pong):
        if not utils.ping_include_resources(ping):
            return

        physical_host = Config.physical_host()

        compute = {
            'type': 'host',
            'kind': 'docker',
            'name': Config.hostname(),
            'physicalHostUuid': physical_host['uuid'],
            'uuid': DockerConfig.docker_uuid()
        }

        pool = {
            'type': 'storagePool',
            'kind': 'docker',
            'name': compute['name'] + ' Storage Pool',
            'hostUuid': compute['uuid'],
            'uuid': compute['uuid'] + '-pool'
        }

        utils.ping_add_resources(pong, physical_host, compute, pool)
开发者ID:pranavs18,项目名称:python-agent,代码行数:25,代码来源:compute.py


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