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

Python deployment_serializers.get_serializer_for_cluster函数代码示例

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

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



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

示例1: test_delete_default_network_group

 def test_delete_default_network_group(self):
     net_name = "storage"
     node_group = objects.Cluster.get_default_group(self.cluster)
     # delete one of default network group
     storage_net = objects.NetworkGroup.get_from_node_group_by_name(
         node_group.id, net_name)
     objects.NetworkGroup.delete(storage_net)
     # download default template and fix it
     net_template = self.env.read_fixtures(['network_template'])[0]
     template_meta = net_template["adv_net_template"]["default"]
     # wide out network from template
     del(template_meta["network_assignments"][net_name])
     for k, v in template_meta["templates_for_node_role"].iteritems():
         if net_name in v:
             v.remove(net_name)
     del(template_meta["network_scheme"][net_name])
     # apply updated template to the cluster
     objects.Cluster.set_network_template(
         self.cluster,
         net_template
     )
     serializer = get_serializer_for_cluster(self.cluster)
     net_serializer = serializer.get_net_provider_serializer(self.cluster)
     # serializer should not fail if we delete one of default network
     # what is not used in template
     net_serializer.generate_network_metadata(self.cluster)
开发者ID:linglong0820,项目名称:fuel-web,代码行数:26,代码来源:test_orchestrator_serializer_70.py


示例2: test_multiple_node_roles_transformations

    def test_multiple_node_roles_transformations(self):
        node = self.cluster.nodes[1]

        serializer = get_serializer_for_cluster(self.cluster)
        net_serializer = serializer.get_net_provider_serializer(self.cluster)

        transformations = net_serializer.generate_transformations(node)

        # Two node roles with the same template should only generate one
        # transformation.
        admin_brs = filter(lambda t: t.get('name') == 'br-fw-admin',
                           transformations)
        self.assertEqual(1, len(admin_brs))

        # Templates are applied in the order as defined in the template.
        # storage network template is applied after the 4 transformations
        # in common
        self.assertEqual('br-storage', transformations[4]['name'])

        # Ensure all ports connected to br-mgmt happen after the bridge
        # has been created
        port_seen = False
        for tx in transformations:
            if tx.get('name') == 'br-mgmt' and tx['action'] == 'add-br' \
                    and port_seen:
                self.fail('Port was added to br-mgmt prior to the bridge '
                          'being created')
            if tx.get('bridge') == 'br-mgmt' and tx['action'] == 'add-port':
                port_seen = True
开发者ID:linglong0820,项目名称:fuel-web,代码行数:29,代码来源:test_orchestrator_serializer_70.py


示例3: check_selective_gateway

    def check_selective_gateway(self, use_net_template=False):
        node = self.env.create_node(cluster_id=self.cluster.id, roles=["controller"], primary_roles=["controller"])
        objects.Cluster.set_network_template(self.cluster, self.net_template if use_net_template else None)
        objects.Cluster.prepare_for_deployment(self.cluster)

        serializer = deployment_serializers.get_serializer_for_cluster(self.cluster)
        net_serializer = serializer.get_net_provider_serializer(self.cluster)
        nm = objects.Cluster.get_network_manager(self.cluster)
        networks_list = nm.get_node_networks(node)
        networks = {net["name"]: net for net in networks_list}
        endpoints = net_serializer.generate_network_scheme(node, networks_list)["endpoints"]

        na = self.net_template["adv_net_template"]["default"]["network_assignments"]
        ep_net_map = {na[net_name]["ep"]: net_name for net_name in na}

        for name in endpoints:
            if name not in ep_net_map:
                self.assertNotIn("vendor_specific", endpoints[name])
                continue
            if networks[ep_net_map[name]].get("gateway") is None:
                self.assertNotIn("vendor_specific", endpoints[name])
            else:
                self.assertIn("vendor_specific", endpoints[name])
                self.assertEqual(
                    endpoints[name]["vendor_specific"]["provider_gateway"], networks[ep_net_map[name]]["gateway"]
                )
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:26,代码来源:test_orchestrator_serializer_90.py


示例4: test_process_skipped_task

    def test_process_skipped_task(self):
        self.prepare_plugins_for_cluster(
            self.cluster,
            [
                {
                    'name': 'task_with_skipped_plugin',
                    'deployment_tasks': [
                        {
                            'id': 'skipped_task',
                            'type': 'skipped',
                        },
                    ],
                },
            ]
        )

        graph = AstuteGraph(self.cluster)
        objects.NodeCollection.prepare_for_deployment(self.cluster.nodes)
        serializer = \
            get_serializer_for_cluster(self.cluster)(graph)
        serialized = serializer.serialize(self.cluster, self.cluster.nodes)

        tasks = serialized[0]['tasks']
        release_depl_tasks_ids = ('first-fake-depl-task',
                                  'second-fake-depl-task')

        serialized_tasks_ids = (t['parameters']['puppet_manifest']
                                for t in tasks)
        self.assertItemsEqual(release_depl_tasks_ids, serialized_tasks_ids)
开发者ID:linglong0820,项目名称:fuel-web,代码行数:29,代码来源:test_orchestrator_serializer_70.py


示例5: check_selective_gateway

    def check_selective_gateway(self, use_net_template=False):
        node = self.env.create_node(
            cluster_id=self.cluster.id,
            roles=['controller'], primary_roles=['controller']
        )
        objects.Cluster.set_network_template(
            self.cluster,
            self.net_template if use_net_template else None)
        objects.Cluster.prepare_for_deployment(self.cluster)

        serializer = deployment_serializers.get_serializer_for_cluster(
            self.cluster)
        net_serializer = serializer.get_net_provider_serializer(self.cluster)
        nm = objects.Cluster.get_network_manager(self.cluster)
        networks_list = nm.get_node_networks(node)
        networks = {net['name']: net for net in networks_list}
        endpoints = net_serializer.generate_network_scheme(
            node, networks_list)['endpoints']

        na = self.net_template[
            'adv_net_template']['default']['network_assignments']
        ep_net_map = {na[net_name]['ep']: net_name for net_name in na}

        for name in endpoints:
            if name not in ep_net_map:
                self.assertNotIn('vendor_specific', endpoints[name])
                continue
            if networks[ep_net_map[name]].get('gateway') is None:
                self.assertNotIn('vendor_specific', endpoints[name])
            else:
                self.assertIn('vendor_specific', endpoints[name])
                self.assertEqual(
                    endpoints[name]['vendor_specific']['provider_gateway'],
                    networks[ep_net_map[name]]['gateway'])
开发者ID:ekorekin,项目名称:fuel-web,代码行数:34,代码来源:test_orchestrator_serializer_90.py


示例6: _serialize_nodes

    def _serialize_nodes(self, nodes):
        serializer = deployment_serializers.get_serializer_for_cluster(
            self.cluster)
        net_serializer = serializer.get_net_provider_serializer(self.cluster)

        serialized_nodes = serializer.node_list(nodes)
        serialized_nodes = net_serializer.update_nodes_net_info(
            self.cluster, serialized_nodes)
        return serialized_nodes
开发者ID:katepimenova,项目名称:fuel-web,代码行数:9,代码来源:tasks_serializer.py


示例7: setUp

    def setUp(self, *args):
        super(TestDeploymentAttributesSerialization70, self).setUp()
        self.cluster = self.create_env('ha_compact')

        # NOTE: 'prepare_for_deployment' is going to be changed for 7.0
        objects.NodeCollection.prepare_for_deployment(self.env.nodes, 'vlan')
        cluster_db = self.db.query(Cluster).get(self.cluster['id'])
        serializer = get_serializer_for_cluster(cluster_db)
        self.serialized_for_astute = serializer(
            AstuteGraph(cluster_db)).serialize(cluster_db, cluster_db.nodes)
开发者ID:phillipsio,项目名称:fuel-web,代码行数:10,代码来源:test_orchestrator_serializer_70.py


示例8: test_get_net_provider_serializer

    def test_get_net_provider_serializer(self):
        serializer = get_serializer_for_cluster(self.cluster)
        self.cluster.network_config.configuration_template = None

        net_serializer = serializer.get_net_provider_serializer(self.cluster)
        self.assertIs(net_serializer, NeutronNetworkDeploymentSerializer80)

        self.cluster.network_config.configuration_template = \
            self.net_template
        net_serializer = serializer.get_net_provider_serializer(self.cluster)
        self.assertIs(net_serializer, NeutronNetworkTemplateSerializer80)
开发者ID:ymkins,项目名称:fuel-web,代码行数:11,代码来源:test_orchestrator_serializer_80.py


示例9: setUp

 def setUp(self):
     super(TestBlockDeviceDevicesSerialization80, self).setUp()
     self.cluster = self.env.create(
         release_kwargs={'version': self.env_version},
         cluster_kwargs={
             'mode': consts.CLUSTER_MODES.ha_compact,
             'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron,
             'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan})
     self.cluster_db = self.db.query(models.Cluster).get(self.cluster['id'])
     serializer_type = get_serializer_for_cluster(self.cluster_db)
     self.serializer = serializer_type(AstuteGraph(self.cluster_db))
开发者ID:ansumanbebarta,项目名称:fuel-web,代码行数:11,代码来源:test_orchestrator_serializer_80.py


示例10: test_get_net_provider_serializer

    def test_get_net_provider_serializer(self):
        serializer = get_serializer_for_cluster(self.cluster)
        self.cluster.network_config.configuration_template = None

        net_serializer = serializer.get_net_provider_serializer(self.cluster)
        self.assertIs(net_serializer, self.legacy_serializer)

        self.cluster.network_config.configuration_template = \
            self.net_template
        net_serializer = serializer.get_net_provider_serializer(self.cluster)
        self.assertIs(net_serializer, self.template_serializer)
开发者ID:jiaolongsun,项目名称:fuel-web,代码行数:11,代码来源:test_orchestrator_serializer_80.py


示例11: setUp

    def setUp(self):
        super(BaseTestDeploymentAttributesSerialization70, self).setUp()
        self.cluster = self.create_env('ha_compact')

        self.prepare_for_deployment(self.env.nodes)
        self.cluster_db = self.db.query(models.Cluster).get(self.cluster['id'])
        serializer_type = get_serializer_for_cluster(self.cluster_db)
        self.serializer = serializer_type(AstuteGraph(self.cluster_db))
        self.serialized_for_astute = self.serializer.serialize(
            self.cluster_db, self.cluster_db.nodes)
        self.vm_data = self.env.read_fixtures(['vmware_attributes'])
开发者ID:linglong0820,项目名称:fuel-web,代码行数:11,代码来源:test_orchestrator_serializer_70.py


示例12: setUp

    def setUp(self, *args):
        super(TestDeploymentSerializationForNovaNetwork70, self).setUp()
        self.cluster = self.create_env('ha_compact')

        # NOTE: 'prepare_for_deployment' is going to be changed for 7.0
        objects.NodeCollection.prepare_for_deployment(self.env.nodes)
        cluster_db = self.db.query(models.Cluster).get(self.cluster['id'])
        serializer_type = get_serializer_for_cluster(cluster_db)
        self.serializer = serializer_type(AstuteGraph(cluster_db))
        self.serialized_for_astute = self.serializer.serialize(
            cluster_db, cluster_db.nodes)
        self.vm_data = self.env.read_fixtures(['vmware_attributes'])
开发者ID:tokumeo,项目名称:fuel-web,代码行数:12,代码来源:test_orchestrator_serializer_70.py


示例13: check_vendor_specific_is_not_set

    def check_vendor_specific_is_not_set(self, use_net_template=False):
        node = self.env.create_node(cluster_id=self.cluster.id, roles=["controller"], primary_roles=["controller"])
        objects.Cluster.set_network_template(self.cluster, self.net_template if use_net_template else None)
        objects.Cluster.prepare_for_deployment(self.cluster)
        serializer = deployment_serializers.get_serializer_for_cluster(self.cluster)
        net_serializer = serializer.get_net_provider_serializer(self.cluster)
        nm = objects.Cluster.get_network_manager(self.cluster)
        networks = nm.get_node_networks(node)
        endpoints = net_serializer.generate_network_scheme(node, networks)["endpoints"]

        for name in endpoints:
            # Just 'provider_gateway' can be in 'vendor_specific'
            if endpoints[name].get("vendor_specific"):
                self.assertItemsEqual(["provider_gateway"], endpoints[name]["vendor_specific"])
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:14,代码来源:test_orchestrator_serializer_90.py


示例14: test_baremetal_neutron_attrs

 def test_baremetal_neutron_attrs(self):
     brmtl_template = deepcopy(
         self.net_template['adv_net_template']['default'])
     brmtl_template['network_assignments']['baremetal'] = {
         'ep': 'br-baremetal'}
     brmtl_template['templates_for_node_role']['controller'].append(
         'baremetal')
     brmtl_template['nic_mapping']['default']['if8'] = 'eth7'
     brmtl_template['network_scheme']['baremetal'] = {
         'endpoints': ['br-baremetal'],
         'transformations': [],
         'roles': {'baremetal': 'br-baremetal'}}
     self.cluster.network_config.configuration_template = {
         'adv_net_template': {'default': brmtl_template}, 'pk': 1}
     serializer_type = get_serializer_for_cluster(self.cluster)
     self.serializer = serializer_type(AstuteGraph(self.cluster))
     self._check_baremetal_neutron_attrs(self.cluster)
开发者ID:ansumanbebarta,项目名称:fuel-web,代码行数:17,代码来源:test_orchestrator_serializer_80.py


示例15: setUp

 def setUp(self):
     super(TestMultiNodeGroupsSerialization80, self).setUp()
     cluster = self.env.create(
         release_kwargs={'version': self.env_version},
         cluster_kwargs={
             'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron,
             'net_segment_type': consts.NEUTRON_SEGMENT_TYPES.vlan}
     )
     self.env.create_nodes_w_interfaces_count(
         nodes_count=3,
         if_count=2,
         roles=['controller', 'cinder'],
         pending_addition=True,
         cluster_id=cluster['id'])
     self.cluster_db = self.db.query(models.Cluster).get(cluster['id'])
     serializer_type = get_serializer_for_cluster(self.cluster_db)
     self.serializer = serializer_type(AstuteGraph(self.cluster_db))
开发者ID:jiaolongsun,项目名称:fuel-web,代码行数:17,代码来源:test_orchestrator_serializer_80.py


示例16: test_plugin_depl_tasks_proper_injections

    def test_plugin_depl_tasks_proper_injections(self):
        self.prepare_plugins_for_cluster(
            self.cluster,
            [
                {
                    'name': 'between_rel_tasks',
                    'deployment_tasks': [
                        {
                            'id': 'between-rel-tasks',
                            'type': 'puppet',
                            'groups': ['primary-controller'],
                            'requires': ['first-fake-depl-task'],
                            'required_for': ['second-fake-depl-task'],
                            'parameters': {
                                'puppet_manifest': 'between-rel-tasks',
                                'puppet_modules': 'test',
                                'timeout': 0,
                            }
                        },
                    ],
                },
            ]
        )

        graph = AstuteGraph(self.cluster)
        objects.NodeCollection.prepare_for_deployment(self.cluster.nodes)
        serializer = \
            get_serializer_for_cluster(self.cluster)(graph)
        serialized = serializer.serialize(self.cluster, self.cluster.nodes)

        serialized_tasks = serialized[0]['tasks']

        expected_priority = {
            100: 'first-fake-depl-task',
            200: 'between-rel-tasks',
            300: 'second-fake-depl-task',
        }

        for task in serialized_tasks:
            task_identificator = task['parameters']['puppet_manifest']
            self.assertEqual(
                task_identificator, expected_priority[task['priority']]
            )
开发者ID:linglong0820,项目名称:fuel-web,代码行数:43,代码来源:test_orchestrator_serializer_70.py


示例17: test_plugin_depl_task_overwrite_from_rel

    def test_plugin_depl_task_overwrite_from_rel(self):
        self.prepare_plugins_for_cluster(
            self.cluster,
            [
                {
                    'name': 'between_rel_tasks',
                    'deployment_tasks': [
                        {
                            'id': 'first-fake-depl-task',
                            'type': 'puppet',
                            'groups': ['primary-controller'],
                            'requires': ['deploy_start'],
                            'required_for': ['second-fake-depl-task'],
                            'parameters': {
                                'puppet_manifest': 'plugin_task',
                                'puppet_modules': 'test',
                                'timeout': 0,
                            }
                        },
                    ],
                },
            ]
        )

        graph = AstuteGraph(self.cluster)
        objects.NodeCollection.prepare_for_deployment(self.cluster.nodes)
        serializer = \
            get_serializer_for_cluster(self.cluster)(graph)
        serialized = serializer.serialize(self.cluster, self.cluster.nodes)

        serialized_tasks = serialized[0]['tasks']

        needed_task_priority = next(
            t['priority'] for t in serialized_tasks
            if t['parameters']['puppet_manifest'] == 'plugin_task'
        )
        # first task in graph has priority equal 100
        self.assertEqual(needed_task_priority, 100)
开发者ID:linglong0820,项目名称:fuel-web,代码行数:38,代码来源:test_orchestrator_serializer_70.py


示例18: test_floating_role_belongs_to_public_bridge

 def test_floating_role_belongs_to_public_bridge(self):
     # download default template and assign floating role to public bridge
     net_template = self.env.read_fixtures(['network_template'])[0]
     schemes = net_template["adv_net_template"]["default"]["network_scheme"]
     schemes["public"]["roles"]["neutron/floating"] = "br-ex"
     # apply updated template to the cluster
     objects.Cluster.set_network_template(
         self.cluster,
         net_template
     )
     cluster_db = self.db.query(models.Cluster).get(self.cluster['id'])
     nm = objects.Cluster.get_network_manager(self.env.clusters[0])
     serializer = get_serializer_for_cluster(self.cluster)
     self.serialized_for_astute = serializer(
         AstuteGraph(cluster_db)).serialize(self.cluster, cluster_db.nodes)
     for node_data in self.serialized_for_astute:
         node = objects.Node.get_by_uid(node_data['uid'])
         # check nodes with assigned public ip
         if objects.Node.should_have_public_with_ip(node):
             nets = nm.get_node_networks(node)
             ng = nm.get_network_by_netname('public', nets)
             endpoints = node_data["network_scheme"]["endpoints"]
             self.assertEqual(endpoints["br-ex"]["IP"], [ng.get('ip')])
开发者ID:linglong0820,项目名称:fuel-web,代码行数:23,代码来源:test_orchestrator_serializer_70.py


示例19: test_usage_of_latest_serializer_in_case_of_new_release_ha

 def test_usage_of_latest_serializer_in_case_of_new_release_ha(self, _):
     cluster = mock.MagicMock(is_ha_mode=True)
     self.assertIs(
         ds.get_serializer_for_cluster(cluster),
         ds.DeploymentHASerializer70)
开发者ID:phillipsio,项目名称:fuel-web,代码行数:5,代码来源:test_deployment_serializer.py


示例20: create_serializer

 def create_serializer(cls, cluster):
     serializer_type = deployment_serializers.get_serializer_for_cluster(
         cluster
     )
     return serializer_type(None)
开发者ID:ekorekin,项目名称:fuel-web,代码行数:5,代码来源:test_orchestrator_serializer_90.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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