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


Python deployment_serializers.get_serializer_for_cluster函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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