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


Python Cluster.get_editable_attributes方法代码示例

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


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

示例1: get_clusters_info

# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_editable_attributes [as 别名]
 def get_clusters_info(self):
     clusters = ClusterCollection.all()
     clusters_info = []
     for cluster in clusters:
         release = cluster.release
         nodes_num = NodeCollection.filter_by(
             None, cluster_id=cluster.id).count()
         vmware_attributes_editable = None
         if cluster.vmware_attributes:
             vmware_attributes_editable = cluster.vmware_attributes.editable
         cluster_info = {
             'id': cluster.id,
             'nodes_num': nodes_num,
             'release': {
                 'os': release.operating_system,
                 'name': release.name,
                 'version': release.version
             },
             'mode': cluster.mode,
             'nodes': self.get_nodes_info(cluster.nodes),
             'node_groups': self.get_node_groups_info(cluster.node_groups),
             'status': cluster.status,
             'extensions': cluster.extensions,
             'attributes': self.get_attributes(
                 Cluster.get_editable_attributes(cluster),
                 self.attributes_white_list
             ),
             'vmware_attributes': self.get_attributes(
                 vmware_attributes_editable,
                 self.vmware_attributes_white_list
             ),
             'plugin_links': self.get_plugin_links(
                 cluster.plugin_links),
             'net_provider': cluster.net_provider,
             'fuel_version': cluster.fuel_version,
             'is_customized': cluster.is_customized,
             'network_configuration': self.get_network_configuration_info(
                 cluster),
             'installed_plugins': self.get_cluster_plugins_info(cluster),
             'components': cluster.components,
             'cluster_plugins': cluster.cluster_plugins
         }
         clusters_info.append(cluster_info)
     return clusters_info
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:46,代码来源:installation_info.py

示例2: inject_mellanox_settings_for_deployment

# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_editable_attributes [as 别名]
    def inject_mellanox_settings_for_deployment(
            cls, node_attrs, cluster, networks):
        """Mellanox settings for deployment

        Serialize mellanox node attrs then it will be merged with common
        attributes, if mellanox plugin or iSER storage enabled.

        :param node_attrs: attributes for specific node
        :type node_attrs: dict
        :param cluster: A cluster instance
        :type cluster: Cluster model
        :param networks: networks related for specific node
        :type networks: list
        :returns: None
        """

        cluster_attrs = Cluster.get_editable_attributes(cluster)
        neutron_mellanox_data = cluster_attrs.get('neutron_mellanox', {})
        # We need to support mellanox for releases < 8.0. So if mellanox
        # attributes exist (primary in old releases) then merge them with
        # common node attributes.
        if neutron_mellanox_data:
            storage_data = cluster_attrs.get('storage', {})
            nm = Cluster.get_network_manager(cluster)
            node_attrs['neutron_mellanox'] = {}

            # Find Physical port for VFs generation
            if 'plugin' in neutron_mellanox_data and \
                    neutron_mellanox_data['plugin']['value'] == 'ethernet':
                # Set config for ml2 mellanox mechanism driver
                node_attrs['neutron_mellanox'].update({
                    'physical_port': nm.get_network_by_netname(
                        'private', networks)['dev'],
                    'ml2_eswitch': {
                        'vnic_type': 'hostdev',
                        'apply_profile_patch': True}
                })

            # Fix network scheme to have physical port for RDMA if iSER enabled
            if 'iser' in storage_data and storage_data['iser']['value']:
                iser_new_name = 'eth_iser0'
                node_attrs['neutron_mellanox'].update({
                    'storage_parent': nm.get_network_by_netname(
                        'storage', networks)['dev'],
                    'iser_interface_name': iser_new_name
                })

                storage_vlan = \
                    nm.get_network_by_netname('storage', networks).get('vlan')
                if storage_vlan:
                    vlan_name = "vlan{0}".format(storage_vlan)
                    # Set storage rule to iSER interface vlan interface
                    node_attrs['network_scheme']['roles']['storage'] = \
                        vlan_name
                    # Set iSER interface vlan interface
                    node_attrs['network_scheme']['interfaces'][vlan_name] = \
                        {'L2': {'vlan_splinters': 'off'}}
                    node_attrs['network_scheme']['endpoints'][vlan_name] = \
                        node_attrs['network_scheme']['endpoints'].pop(
                            'br-storage', {})
                    node_attrs['network_scheme']['endpoints'][vlan_name][
                        'vlandev'] = iser_new_name
                else:
                    # Set storage rule to iSER port
                    node_attrs['network_scheme']['roles'][
                        'storage'] = iser_new_name
                    node_attrs['network_scheme']['interfaces'][
                        iser_new_name] = {'L2': {'vlan_splinters': 'off'}}
                    node_attrs['network_scheme']['endpoints'][
                        iser_new_name] = node_attrs['network_scheme'][
                        'endpoints'].pop('br-storage', {})
开发者ID:ansumanbebarta,项目名称:fuel-web,代码行数:73,代码来源:base_serializers.py


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