本文整理汇总了Python中nailgun.extensions.volume_manager.extension.VolumeManagerExtension.get_node_volumes方法的典型用法代码示例。如果您正苦于以下问题:Python VolumeManagerExtension.get_node_volumes方法的具体用法?Python VolumeManagerExtension.get_node_volumes怎么用?Python VolumeManagerExtension.get_node_volumes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.extensions.volume_manager.extension.VolumeManagerExtension
的用法示例。
在下文中一共展示了VolumeManagerExtension.get_node_volumes方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_recalculates_vg_sizes_when_disks_volumes_size_update
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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)
示例2: test_multirole_controller_cinder_ceph
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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))
示例3: test_allocates_all_free_space_for_vm_for_compute_role
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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))
示例4: test_allocates_all_free_space_for_os_for_controller_role
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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_node_volumes(node))
self.check_disk_size_equal_sum_of_all_volumes(
VolumeManagerExtension.get_node_volumes(node))
示例5: test_allocates_all_free_space_for_vm_for_cinder_role
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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))
示例6: test_allocates_space_single_disk_for_ceph_for_ceph_role
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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))
示例7: setUp
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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)
示例8: test_node_serialization
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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)
示例9: test_update_ceph_partition
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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)
示例10: test_update_ceph_partition
# 需要导入模块: from nailgun.extensions.volume_manager.extension import VolumeManagerExtension [as 别名]
# 或者: from nailgun.extensions.volume_manager.extension.VolumeManagerExtension import get_node_volumes [as 别名]
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)