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


Python extension.VolumeManagerExtension类代码示例

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


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

示例1: test_recalculates_vg_sizes_when_disks_volumes_size_update

    def test_recalculates_vg_sizes_when_disks_volumes_size_update(self):
        node_db = self.create_node()
        disks = self.get(node_db.id)

        vgs_before_update = filter(
            lambda volume: volume.get('type') == 'vg',
            VolumeManagerExtension.get_node_volumes(node_db))

        new_volume_size = 4200
        updated_disks_count = 0
        for disk in disks:
            if disk['size'] > 0:
                for volume in disk['volumes']:
                    volume['size'] = new_volume_size
                updated_disks_count += 1

        self.put(node_db.id, disks)

        vgs_after_update = filter(
            lambda volume: volume.get('type') == 'vg',
            VolumeManagerExtension.get_node_volumes(node_db))

        for vg_before, vg_after in zip(vgs_before_update, vgs_after_update):
            size_volumes_before = sum([
                volume.get('size', 0) for volume in vg_before['volumes']])
            size_volumes_after = sum([
                volume.get('size', 0) for volume in vg_after['volumes']])

            self.assertNotEqual(size_volumes_before, size_volumes_after)

            volume_group_size = new_volume_size * updated_disks_count
            self.assertEqual(size_volumes_after, volume_group_size)
开发者ID:mba811,项目名称:fuel-web,代码行数:32,代码来源:test_node_disks.py

示例2: test_multirole_controller_cinder_ceph

 def test_multirole_controller_cinder_ceph(self):
     node = self.create_node('controller', 'cinder', 'ceph-osd')
     self.should_contain_os_with_minimal_size(node.volume_manager)
     self.should_allocates_same_size(
         node.volume_manager.volumes, ['image', 'cinder', 'ceph'])
     self.logical_volume_sizes_should_equal_all_phisical_volumes(
         VolumeManagerExtension.get_node_volumes(node))
     self.check_disk_size_equal_sum_of_all_volumes(
         VolumeManagerExtension.get_node_volumes(node))
开发者ID:mba811,项目名称:fuel-web,代码行数:9,代码来源:test_node_disks.py

示例3: test_allocates_all_free_space_for_vm_for_compute_role

 def test_allocates_all_free_space_for_vm_for_compute_role(self):
     node = self.create_node('compute')
     self.should_contain_os_with_minimal_size(node.volume_manager)
     self.all_free_space_except_os_for_volume(
         node.volume_manager.volumes, 'vm')
     self.logical_volume_sizes_should_equal_all_phisical_volumes(
         VolumeManagerExtension.get_node_volumes(node))
     self.check_disk_size_equal_sum_of_all_volumes(
         VolumeManagerExtension.get_node_volumes(node))
开发者ID:mba811,项目名称:fuel-web,代码行数:9,代码来源:test_node_disks.py

示例4: test_allocates_all_free_space_for_os_for_controller_role

    def test_allocates_all_free_space_for_os_for_controller_role(self):
        node = self.create_node('controller')
        disks = only_disks(node.volume_manager.volumes)
        disks_size_sum = sum([disk['size'] for disk in disks])
        os_sum_size = self.os_size(disks)
        glance_sum_size = self.glance_size(disks)
        reserved_size = self.reserved_size(disks)

        self.assertEqual(disks_size_sum - reserved_size,
                         os_sum_size + glance_sum_size)
        self.logical_volume_sizes_should_equal_all_phisical_volumes(
            VolumeManagerExtension.get_volumes(node))
        self.check_disk_size_equal_sum_of_all_volumes(
            VolumeManagerExtension.get_volumes(node))
开发者ID:nebril,项目名称:fuel-web,代码行数:14,代码来源:test_node_disks.py

示例5: test_allocates_all_free_space_for_vm_for_cinder_role

 def test_allocates_all_free_space_for_vm_for_cinder_role(self):
     node = self.create_node('cinder')
     self.should_contain_os_with_minimal_size(VolumeManager(node))
     self.all_free_space_except_os_for_volume(
         VolumeManager(node).volumes, 'cinder')
     self.check_disk_size_equal_sum_of_all_volumes(
         VolumeManagerExtension.get_node_volumes(node))
开发者ID:ekorekin,项目名称:fuel-web,代码行数:7,代码来源:test_node_disks.py

示例6: test_allocates_space_single_disk_for_ceph_for_ceph_role

 def test_allocates_space_single_disk_for_ceph_for_ceph_role(self):
     node = self.create_node('ceph-osd')
     self.update_node_with_single_disk(node, 30000)
     self.should_contain_os_with_minimal_size(node.volume_manager)
     self.all_free_space_except_os_for_volume(
         node.volume_manager.volumes, 'ceph')
     self.check_disk_size_equal_sum_of_all_volumes(
         VolumeManagerExtension.get_node_volumes(node))
开发者ID:mba811,项目名称:fuel-web,代码行数:8,代码来源:test_node_disks.py

示例7: update_volumes

    def update_volumes(cls, instance):
        """Update volumes for Node instance.
        Adds pending "disks" changes for Cluster which Node belongs to

        :param instance: Node instance
        :returns: None
        """
        attrs = instance.attributes
        if not attrs:
            attrs = cls.create_attributes(instance)

        try:
            # TODO(eli): update volumes method should be moved
            # into an extension
            # Should be done as a part of blueprint:
            # https://blueprints.launchpad.net/fuel/+spec
            #                                 /volume-manager-refactoring
            from nailgun.extensions.volume_manager.extension \
                import VolumeManagerExtension
            VolumeManagerExtension.set_volumes(
                instance,
                instance.volume_manager.gen_volumes_info())
        except Exception as exc:
            msg = (
                u"Failed to generate volumes "
                u"info for node '{0}': '{1}'"
            ).format(
                instance.name or instance.mac or instance.id,
                str(exc) or "see logs for details"
            )
            logger.warning(traceback.format_exc())
            Notification.create({
                "topic": "error",
                "message": msg,
                "node_id": instance.id
            })

        if instance.cluster_id:
            Cluster.add_pending_changes(
                instance.cluster,
                "disks",
                node_id=instance.id
            )

        db().add(attrs)
        db().flush()
开发者ID:prmtl,项目名称:fuel-web,代码行数:46,代码来源:node.py

示例8: setUp

 def setUp(self):
     super(TestVolumeManagerHelpers, self).setUp()
     self.env.create(
         nodes_kwargs=[
             {'roles': ['controller']},
         ]
     )
     self.node = self.env.nodes[0]
     self.volumes = VolumeManagerExtension.get_node_volumes(self.node)
开发者ID:thefuyang,项目名称:fuel-web,代码行数:9,代码来源:test_volume_manager.py

示例9: test_node_serialization

    def test_node_serialization(self):
        for node in self.serialized_cluster['nodes']:
            node_db = self.db.query(Node).filter_by(
                hostname=node['name']
            ).first()
            # Get interface (in our case we created only one for each node)
            intr_db = node_db.nic_interfaces[0]
            intr_name = intr_db.name
            intr_mac = intr_db.mac
            kernal_params = self.attributes.get('kernel_params', {}) \
                .get('kernel', {}).get('value')
            self.assertEqual(
                node['ks_meta']['cloud_init_templates'], {
                    'boothook': 'boothook_fuel_6.1_centos.jinja2',
                    'cloud_config': 'cloud_config_fuel_6.1_centos.jinja2',
                    'meta_data': 'meta_data_fuel_6.1_centos.jinja2'
                }
            )
            self.assertEqual(node['uid'], node_db.uid)
            self.assertEqual(node['power_address'], node_db.ip)
            self.assertEqual(node['name'], "node-{0}".format(node_db.id))
            self.assertEqual(node['hostname'],
                             objects.Node.get_node_fqdn(node_db))
            self.assertEqual(
                node['power_pass'], settings.PATH_TO_BOOTSTRAP_SSH_KEY)

            self.assertDictEqual(node['kernel_options'], {
                'netcfg/choose_interface':
                objects.Node.get_admin_physical_iface(node_db).mac,
                'udevrules': '{0}_{1}'.format(intr_mac, intr_name)
            })

            self.assertDictEqual(node['ks_meta']['pm_data'], {
                'ks_spaces': VolumeManagerExtension.get_node_volumes(node_db),
                'kernel_params': kernal_params
            })
            # Check node interfaces section
            self.assertEqual(
                node['interfaces'][intr_name]['mac_address'], intr_mac)
            self.assertEqual(
                node['interfaces'][intr_name]['static'], '0')
            self.assertEqual(
                node['interfaces'][intr_name]['dns_name'],
                objects.Node.get_node_fqdn(node_db))
            # Check node interfaces extra section
            self.assertEqual(node['interfaces_extra'][intr_name], {
                'peerdns': 'no',
                'onboot': 'yes'
            })
            # check identity key for mcollective
            self.assertEqual(node['ks_meta']['mco_identity'], node_db.id)
开发者ID:dnikishov,项目名称:fuel-web,代码行数:51,代码来源:test_provisioning_serializer.py

示例10: test_update_ceph_partition

    def test_update_ceph_partition(self):
        node = self.create_node(roles=['ceph-osd'])
        disks = self.get(node.id)

        new_volume_size = 4321
        for disk in disks:
            if disk['size'] > 0:
                for volume in disk['volumes']:
                    volume['size'] = new_volume_size

        self.put(node.id, disks)
        partitions_after_update = filter(
            lambda volume: volume.get('type') == 'partition',
            VolumeManagerExtension.get_node_volumes(node))

        for partition_after in partitions_after_update:
            self.assertEqual(partition_after['size'], new_volume_size)
开发者ID:mba811,项目名称:fuel-web,代码行数:17,代码来源:test_node_disks.py

示例11: test_update_ceph_partition

    def test_update_ceph_partition(self):
        node = self.create_node(roles=["ceph-osd"])
        disks = self.get(node.id)

        new_volume_size = 4321
        for disk in disks:
            if disk["size"] > 0:
                for volume in disk["volumes"]:
                    volume["size"] = new_volume_size

        self.put(node.id, disks)
        partitions_after_update = filter(
            lambda volume: volume.get("type") == "partition", VolumeManagerExtension.get_node_volumes(node)
        )

        for partition_after in partitions_after_update:
            self.assertEqual(partition_after["size"], new_volume_size)
开发者ID:MoArif,项目名称:fuel-web,代码行数:17,代码来源:test_node_disks.py

示例12: is_checking_required

 def is_checking_required(self):
     return VolumeManagerExtension._is_disk_checking_required(self.node)
开发者ID:ekorekin,项目名称:fuel-web,代码行数:2,代码来源:test_callback.py

示例13: serialize_node

    def serialize_node(cls, cluster_attrs, node):
        """Serialize a single node."""
        serialized_node = {
            'uid': node.uid,
            'power_address': node.ip,
            'name': objects.Node.make_slave_name(node),
            # right now it duplicates to avoid possible issues
            'slave_name': objects.Node.make_slave_name(node),
            'hostname': node.fqdn,
            'power_pass': cls.get_ssh_key_path(node),

            'profile': cluster_attrs['cobbler']['profile'],
            'power_type': 'ssh',
            'power_user': 'root',
            'name_servers': '\"%s\"' % settings.DNS_SERVERS,
            'name_servers_search': '\"%s\"' % settings.DNS_SEARCH,
            'netboot_enabled': '1',
            # For provisioning phase
            'kernel_options': {
                'netcfg/choose_interface':
                objects.Node.get_admin_physical_iface(node).mac,
                'udevrules': cls.interfaces_mapping_for_udev(node)},
            'ks_meta': {
                'pm_data': {
                    'ks_spaces': VolumeManagerExtension.get_volumes(node),
                    'kernel_params': objects.Node.get_kernel_params(node)},
                'fuel_version': node.cluster.fuel_version,
                'puppet_auto_setup': 1,
                'puppet_master': settings.PUPPET_MASTER_HOST,
                'puppet_enable': 0,
                'mco_auto_setup': 1,
                'install_log_2_syslog': 1,
                'mco_pskey': settings.MCO_PSKEY,
                'mco_vhost': settings.MCO_VHOST,
                'mco_host': settings.MCO_HOST,
                'mco_user': settings.MCO_USER,
                'mco_password': settings.MCO_PASSWORD,
                'mco_connector': settings.MCO_CONNECTOR,
                'mco_enable': 1,
                'auth_key': "\"%s\"" % cluster_attrs.get('auth_key', ''),
                'authorized_keys':
                ["\"%s\"" % key for key in settings.AUTHORIZED_KEYS],
                'master_ip': settings.MASTER_IP,
                'timezone': settings.TIMEZONE,
            }}

        provision_data = cluster_attrs.get('provision')
        if provision_data:
            if provision_data['method'] == consts.PROVISION_METHODS.image:
                serialized_node['ks_meta']['image_data'] = \
                    provision_data['image_data']

        serialized_node['ks_meta']['repo_setup'] = cluster_attrs['repo_setup']

        vlan_splinters = cluster_attrs.get('vlan_splinters', {})
        if vlan_splinters.get('vswitch') == 'kernel_lt':
            serialized_node['ks_meta']['kernel_lt'] = 1

        mellanox_data = cluster_attrs.get('neutron_mellanox')
        if mellanox_data:
            serialized_node['ks_meta'].update({
                'mlnx_vf_num': mellanox_data['vf_num'],
                'mlnx_plugin_mode': mellanox_data['plugin'],
                'mlnx_iser_enabled': cluster_attrs['storage']['iser'],
            })
            # Add relevant kernel parameter when using Mellanox SR-IOV
            # and/or iSER (which works on top of a probed virtual function)
            # unless it was explicitly added by the user
            pm_data = serialized_node['ks_meta']['pm_data']
            if ((mellanox_data['plugin'] == 'ethernet' or
                    cluster_attrs['storage']['iser'] is True) and
                    'intel_iommu=' not in pm_data['kernel_params']):
                        pm_data['kernel_params'] += ' intel_iommu=on'

        net_manager = objects.Cluster.get_network_manager(node.cluster)
        gw = net_manager.get_default_gateway(node.id)
        serialized_node['ks_meta'].update({'gw': gw})
        serialized_node['ks_meta'].update(
            {'admin_net': net_manager.get_admin_network_group(node.id).cidr}
        )

        serialized_node.update(cls.serialize_interfaces(node))

        return serialized_node
开发者ID:nebril,项目名称:fuel-web,代码行数:84,代码来源:provisioning_serializers.py


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