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

Python manager.calc_glance_cache_size函数代码示例

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

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



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

示例1: _serialize_node

    def _serialize_node(cls, node, role):
        """Serialize node, then it will be
        merged with common attributes
        """
        network_data = node.network_data
        interfaces = cls.configure_interfaces(node)
        cls.__add_hw_interfaces(interfaces, node.meta['interfaces'])

        node_attrs = {
            # Yes, uid is really should be a string
            'uid': str(node.id),
            'fqdn': node.fqdn,
            'status': node.status,
            'role': role,
            'glance': {
                'image_cache_max_size': manager.calc_glance_cache_size(
                    node.attributes.volumes)
            },
            # Interfaces assingment
            'network_data': interfaces,

            # TODO (eli): need to remove, requried
            # for fucking fake thread only
            'online': node.online,
        }
        node_attrs.update(cls.interfaces_list(network_data))

        return node_attrs
开发者ID:andrey-borisov,项目名称:fuel-web,代码行数:28,代码来源:deployment_serializers.py


示例2: test_glance_cache_size_property_more_than_5gb

 def test_glance_cache_size_property_more_than_5gb(self):
     volumes_size = manager.gb_to_byte(120)
     with patch.object(manager,
                       'find_size_by_name') as get_size:
         get_size.return_value = volumes_size
         result = manager.calc_glance_cache_size(self.volumes)
     self.assertEqual(result, str(int(volumes_size * 0.1)))
开发者ID:andrey-borisov,项目名称:fuel-web,代码行数:7,代码来源:test_volume_manager.py


示例3: test_glance_cache_size_property_less_then_5gb

 def test_glance_cache_size_property_less_then_5gb(self):
     volumes_size = manager.gb_to_mb(30)
     default = manager.gb_to_byte(5)
     with patch.object(manager,
                       'find_size_by_name') as get_size:
         get_size.return_value = volumes_size
         result = manager.calc_glance_cache_size(self.volumes)
     self.assertEqual(result, str(default))
开发者ID:TorstenS73,项目名称:fuel-web,代码行数:8,代码来源:test_volume_manager.py


示例4: get_image_cache_max_size

 def get_image_cache_max_size(self, node):
     images_ceph = (node.cluster.attributes['editable']['storage']
                    ['images_ceph']['value'])
     if images_ceph:
         image_cache_max_size = '0'
     else:
         image_cache_max_size = volume_manager.calc_glance_cache_size(
             node.attributes.volumes)
     return {'glance': {'image_cache_max_size': image_cache_max_size}}
开发者ID:zbwzy,项目名称:nailgun,代码行数:9,代码来源:deployment_serializers.py


示例5: test_serialize_node

    def test_serialize_node(self):
        node = self.env.create_node(api=True, cluster_id=self.cluster.id, pending_addition=True)
        self.cluster.prepare_for_deployment()

        node_db = self.db.query(Node).get(node["id"])
        serialized_data = self.serializer.serialize_node(node_db, "controller")

        self.assertEquals(serialized_data["role"], "controller")
        self.assertEquals(serialized_data["uid"], str(node_db.id))
        self.assertEquals(serialized_data["status"], node_db.status)
        self.assertEquals(serialized_data["online"], node_db.online)
        self.assertEquals(serialized_data["fqdn"], "node-%d.%s" % (node_db.id, settings.DNS_DOMAIN))
        self.assertEquals(
            serialized_data["glance"],
            {"image_cache_max_size": manager.calc_glance_cache_size(node_db.attributes.volumes)},
        )
开发者ID:rsokolkov,项目名称:fuel-web,代码行数:16,代码来源:test_orchestrator_serializer.py


示例6: test_serialize_node

    def test_serialize_node(self):
        node = self.env.create_node(
            api=True, cluster_id=self.cluster.id, pending_addition=True)
        TaskHelper.prepare_for_deployment(self.cluster.nodes)

        node_db = self.db.query(Node).get(node['id'])
        serialized_data = self.serializer.serialize_node(node_db, 'controller')

        self.assertEquals(serialized_data['role'], 'controller')
        self.assertEquals(serialized_data['uid'], str(node_db.id))
        self.assertEquals(serialized_data['status'], node_db.status)
        self.assertEquals(serialized_data['online'], node_db.online)
        self.assertEquals(serialized_data['fqdn'],
                          'node-%d.%s' % (node_db.id, settings.DNS_DOMAIN))
        self.assertEquals(
            serialized_data['glance'],
            {'image_cache_max_size': manager.calc_glance_cache_size(
                node_db.attributes.volumes)})
开发者ID:kdemina,项目名称:fuel-web,代码行数:18,代码来源:test_orchestrator_serializer.py


示例7: serialize_node

    def serialize_node(cls, node, role):
        """Serialize node, then it will be
        merged with common attributes
        """
        node_attrs = {
            # Yes, uid is really should be a string
            'uid': str(node.id),
            'fqdn': node.fqdn,
            'status': node.status,
            'role': role,
            'glance': {
                'image_cache_max_size': VolumeManager.calc_glance_cache_size(
                    node.attributes.volumes)
            },
            # TODO (eli): need to remove, requried
            # for fucking fake thread only
            'online': node.online
        }

        node_attrs.update(NetworkDeploymentSerializer.node_attrs(node))

        return node_attrs
开发者ID:AlexeyKasatkin,项目名称:fuel-web,代码行数:22,代码来源:deployment_serializers.py


示例8: test_nova_deploy_cast_with_right_args


#.........这里部分代码省略.........

                individual_atts = {
                    'uid': str(node.id),
                    'status': node.status,
                    'role': role,
                    'online': node.online,
                    'fqdn': 'node-%d.%s' % (node.id, settings.DNS_DOMAIN),
                    'priority': priority,

                    'network_data': {
                        'eth0': {
                            'interface': 'eth0',
                            'ipaddr': ['%s/24' % ips['public']],
                            'gateway': '172.16.0.1'},
                        'eth0.101': {
                            'interface': 'eth0.101',
                            'ipaddr': ['%s/24' % ips['internal']]},
                        'eth0.102': {
                            'interface': 'eth0.102',
                            'ipaddr': ['%s/24' % ips['storage']]},
                        'eth0.103': {
                            'interface': 'eth0.103',
                            'ipaddr': 'none'},
                        'lo': {
                            'interface': 'lo',
                            'ipaddr': ['127.0.0.1/8']},
                        'eth1': {
                            'interface': 'eth1',
                            'ipaddr': [ips['admin']]}
                    }}

                individual_atts.update(common_attrs)
                individual_atts['glance']['image_cache_max_size'] = str(
                    manager.calc_glance_cache_size(node.attributes.volumes)
                )
                deployment_info.append(deepcopy(individual_atts))

        controller_nodes = filter(
            lambda node: node['role'] == 'controller',
            deployment_info)
        controller_nodes[0]['role'] = 'primary-controller'

        supertask = self.env.launch_deployment()
        deploy_task_uuid = [x.uuid for x in supertask.subtasks
                            if x.name == 'deployment'][0]

        deployment_msg = {'method': 'deploy',
                          'respond_to': 'deploy_resp',
                          'args': {}}

        deployment_msg['args']['task_uuid'] = deploy_task_uuid
        deployment_msg['args']['deployment_info'] = deployment_info

        provision_nodes = []
        admin_net = self.env.network_manager.get_admin_network_group()

        for n in sorted(self.env.nodes, key=lambda n: n.id):
            udev_interfaces_mapping = ','.join([
                '{0}_{1}'.format(i.mac, i.name) for i in n.interfaces])
            eth1_mac = [i.mac for i in n.interfaces if i.name == 'eth1'][0]

            pnd = {
                'profile': cluster_attrs['cobbler']['profile'],
                'power_type': 'ssh',
                'power_user': 'root',
                'kernel_options': {
开发者ID:sirmax123,项目名称:fuel-web,代码行数:67,代码来源:test_cluster_changes_handler.py


示例9: test_neutron_deploy_cast_with_right_args


#.........这里部分代码省略.........
                                "action": "add-br",
                                "name": "br-mgmt"},
                            {
                                "action": "add-br",
                                "name": "br-storage"},
                            {
                                "action": "add-br",
                                "name": "br-prv"},
                            {
                                "action": "add-br",
                                "name": u"br-eth0"},
                            {
                                "action": "add-port",
                                "bridge": u"br-eth0",
                                "name": u"eth0"},
                            {
                                "action": "add-patch",
                                "bridges": [u"br-eth0", "br-storage"],
                                "tags": [102, 0]},
                            {
                                "action": "add-patch",
                                "bridges": [u"br-eth0", "br-ex"],
                                "trunks": [0]},
                            {
                                "action": "add-patch",
                                "bridges": [u"br-eth0", "br-mgmt"],
                                "tags": [101, 0]}
                        ]
                    }
                }

                individual_atts.update(common_attrs)
                individual_atts['glance']['image_cache_max_size'] = str(
                    manager.calc_glance_cache_size(node.attributes.volumes)
                )
                deployment_info.append(deepcopy(individual_atts))

        controller_nodes = filter(
            lambda node: node['role'] == 'controller',
            deployment_info)
        controller_nodes[0]['role'] = 'primary-controller'

        supertask = self.env.launch_deployment()
        deploy_task_uuid = [x.uuid for x in supertask.subtasks
                            if x.name == 'deployment'][0]

        deployment_msg = {'method': 'deploy',
                          'respond_to': 'deploy_resp',
                          'args': {}}

        deployment_msg['args']['task_uuid'] = deploy_task_uuid
        deployment_msg['args']['deployment_info'] = deployment_info

        provision_nodes = []
        admin_net = self.env.network_manager.get_admin_network_group()

        for n in sorted(self.env.nodes, key=lambda n: n.id):
            udev_interfaces_mapping = ','.join([
                '{0}_{1}'.format(i.mac, i.name) for i in n.interfaces])
            eth1_mac = [i.mac for i in n.interfaces if i.name == 'eth1'][0]

            pnd = {
                'profile': cluster_attrs['cobbler']['profile'],
                'power_type': 'ssh',
                'power_user': 'root',
                'kernel_options': {
开发者ID:sirmax123,项目名称:fuel-web,代码行数:67,代码来源:test_cluster_changes_handler.py


示例10: test_nova_deploy_cast_with_right_args


#.........这里部分代码省略.........
                individual_atts = {
                    'uid': str(node.id),
                    'status': node.status,
                    'role': role,
                    'online': node.online,
                    'fail_if_error': is_critical,
                    'fqdn': 'node-%d.%s' % (node.id, settings.DNS_DOMAIN),
                    'priority': priority,

                    'network_data': {
                        'eth0': {
                            'interface': 'eth0',
                            'ipaddr': ['%s/24' % ips['public']],
                            'gateway': '172.16.0.1'},
                        'eth0.101': {
                            'interface': 'eth0.101',
                            'ipaddr': ['%s/24' % ips['internal']]},
                        'eth0.102': {
                            'interface': 'eth0.102',
                            'ipaddr': ['%s/24' % ips['storage']]},
                        'eth0.103': {
                            'interface': 'eth0.103',
                            'ipaddr': 'none'},
                        'lo': {
                            'interface': 'lo',
                            'ipaddr': ['127.0.0.1/8']},
                        'eth1': {
                            'interface': 'eth1',
                            'ipaddr': [ips['admin']]}
                    }}

                individual_atts.update(common_attrs)
                individual_atts['glance']['image_cache_max_size'] = str(
                    manager.calc_glance_cache_size(node.attributes.volumes)
                )
                deployment_info.append(deepcopy(individual_atts))

        controller_nodes = filter(
            lambda node: node['role'] == 'controller',
            deployment_info)
        controller_nodes[0]['role'] = 'primary-controller'
        controller_nodes[0]['fail_if_error'] = True

        supertask = self.env.launch_deployment()
        deploy_task_uuid = [x.uuid for x in supertask.subtasks
                            if x.name == 'deployment'][0]

        deployment_msg = {
            'api_version': '1',
            'method': 'deploy',
            'respond_to': 'deploy_resp',
            'args': {}
        }

        deployment_msg['args']['task_uuid'] = deploy_task_uuid
        deployment_msg['args']['deployment_info'] = deployment_info

        provision_nodes = []
        admin_net = self.env.network_manager.get_admin_network_group()

        for n in sorted(self.env.nodes, key=lambda n: n.id):
            udev_interfaces_mapping = ','.join([
                '{0}_{1}'.format(i.mac, i.name) for i in n.interfaces])
            eth1_mac = [i.mac for i in n.interfaces if i.name == 'eth1'][0]

            pnd = {
开发者ID:CGenie,项目名称:fuel-web,代码行数:67,代码来源:test_cluster_changes_handler.py


示例11: test_neutron_deploy_cast_with_right_args


#.........这里部分代码省略.........
                            {
                                "action": "add-br",
                                "name": "br-storage"},
                            {
                                "action": "add-br",
                                "name": "br-fw-admin"},
                            {
                                "action": "add-br",
                                "name": "br-ex"},
                            {
                                "action": "add-patch",
                                "bridges": [u"br-eth0", "br-storage"],
                                "tags": [102, 0],
                                "vlan_ids": [102, 0]},
                            {
                                "action": "add-patch",
                                "bridges": [u"br-eth0", "br-mgmt"],
                                "tags": [101, 0],
                                "vlan_ids": [101, 0]},
                            {
                                "action": "add-patch",
                                "bridges": [u"br-eth1", "br-fw-admin"],
                                "trunks": [0]},
                            {
                                "action": "add-patch",
                                "bridges": [u"br-eth0", "br-ex"],
                                "trunks": [0]},
                        ]
                    }
                }

                individual_atts.update(common_attrs)
                individual_atts['glance']['image_cache_max_size'] = str(
                    manager.calc_glance_cache_size(node.attributes.volumes)
                )
                deployment_info.append(deepcopy(individual_atts))

        controller_nodes = filter(
            lambda node: node['role'] == 'controller',
            deployment_info)
        controller_nodes[0]['role'] = 'primary-controller'
        controller_nodes[0]['fail_if_error'] = True

        supertask = self.env.launch_deployment()
        deploy_task_uuid = [x.uuid for x in supertask.subtasks
                            if x.name == 'deployment'][0]

        deployment_msg = {
            'api_version': '1',
            'method': 'deploy',
            'respond_to': 'deploy_resp',
            'args': {}
        }

        deployment_msg['args']['task_uuid'] = deploy_task_uuid
        deployment_msg['args']['deployment_info'] = deployment_info

        provision_nodes = []
        admin_net = self.env.network_manager.get_admin_network_group()

        for n in sorted(self.env.nodes, key=lambda n: n.id):
            udev_interfaces_mapping = ','.join([
                '{0}_{1}'.format(i.mac, i.name) for i in n.interfaces])
            eth1_mac = [i.mac for i in n.interfaces if i.name == 'eth1'][0]

            pnd = {
开发者ID:CGenie,项目名称:fuel-web,代码行数:67,代码来源:test_cluster_changes_handler.py


示例12: test_nova_deploy_cast_with_right_args


#.........这里部分代码省略.........
        common_attrs["last_controller"] = controller_nodes[-1]["name"]

        # Individual attrs calculation and
        # merging with common attrs
        priority_mapping = {"controller": [600, 500, 400], "cinder": 700, "compute": 700}

        deployment_info = []
        for node in nodes_db:
            ips = assigned_ips[node.id]
            for role in sorted(node.roles):
                priority = priority_mapping[role]
                if isinstance(priority, list):
                    priority = priority.pop()

                individual_atts = {
                    "uid": str(node.id),
                    "status": node.status,
                    "role": role,
                    "online": node.online,
                    "fqdn": "node-%d.%s" % (node.id, settings.DNS_DOMAIN),
                    "priority": priority,
                    "network_data": {
                        "eth0": {"interface": "eth0", "ipaddr": ["%s/24" % ips["public"]], "gateway": "172.16.0.1"},
                        "eth0.101": {"interface": "eth0.101", "ipaddr": ["%s/24" % ips["internal"]]},
                        "eth0.102": {"interface": "eth0.102", "ipaddr": ["%s/24" % ips["storage"]]},
                        "eth0.103": {"interface": "eth0.103", "ipaddr": "none"},
                        "lo": {"interface": "lo", "ipaddr": ["127.0.0.1/8"]},
                        "eth1": {"interface": "eth1", "ipaddr": [ips["admin"]]},
                    },
                }

                individual_atts.update(common_attrs)
                individual_atts["glance"]["image_cache_max_size"] = str(
                    manager.calc_glance_cache_size(node.attributes.volumes)
                )
                deployment_info.append(deepcopy(individual_atts))

        controller_nodes = filter(lambda node: node["role"] == "controller", deployment_info)
        controller_nodes[0]["role"] = "primary-controller"

        supertask = self.env.launch_deployment()
        deploy_task_uuid = [x.uuid for x in supertask.subtasks if x.name == "deployment"][0]

        deployment_msg = {"method": "deploy", "respond_to": "deploy_resp", "args": {}}

        deployment_msg["args"]["task_uuid"] = deploy_task_uuid
        deployment_msg["args"]["deployment_info"] = deployment_info

        provision_nodes = []
        admin_net = self.env.network_manager.get_admin_network()

        for n in sorted(self.env.nodes, key=lambda n: n.id):
            udev_interfaces_mapping = ",".join(["{0}_{1}".format(i.mac, i.name) for i in n.interfaces])

            pnd = {
                "profile": cluster_attrs["cobbler"]["profile"],
                "power_type": "ssh",
                "power_user": "root",
                "kernel_options": {"netcfg/choose_interface": "eth1", "udevrules": udev_interfaces_mapping},
                "power_address": n.ip,
                "power_pass": settings.PATH_TO_BOOTSTRAP_SSH_KEY,
                "name": TaskHelper.make_slave_name(n.id),
                "hostname": n.fqdn,
                "name_servers": '"%s"' % settings.DNS_SERVERS,
                "name_servers_search": '"%s"' % settings.DNS_SEARCH,
                "netboot_enabled": "1",
开发者ID:pombredanne,项目名称:fuel-web,代码行数:67,代码来源:test_cluster_changes_handler.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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