The nova.tests.test_xenapi Module

Test suite for XenAPI.

class CompareVersionTestCase(*args, **kwargs)

Bases: nova.test.TestCase

test_equal()
test_greater_than()
test_length()
test_less_than()
test_non_lexical()
class HypervisorPoolTestCase(*args, **kwargs)

Bases: nova.test.TestCase

fake_aggregate = {'metadetails': {'master_compute': 'master', 'operational_state': {}, 'hypervisor_pool': {}}, 'hosts': [], 'id': 98}
test_slave_asks_master_to_add_slave_to_pool()
test_slave_asks_master_to_remove_slave_from_pool()
class MockComputeAPI

Bases: object

add_aggregate_host(ctxt, aggregate, host_param, host, slave_info)
remove_aggregate_host(ctxt, aggregate_id, host_param, host, slave_info)
class ResourcePoolWithStubs

Bases: nova.tests.test_xenapi.StubDependencies, nova.virt.xenapi.pool.ResourcePool

A ResourcePool, use stub dependencies.

class StubDependencies

Bases: object

Stub dependencies for ResourcePool.

class SwapXapiHostTestCase(*args, **kwargs)

Bases: nova.test.TestCase

test_no_path()
test_no_port()
test_swapping()
class ToSupportedInstancesTestCase(*args, **kwargs)

Bases: nova.test.TestCase

test_default_return_value()
test_invalid_values_do_not_break()
test_multiple_values()
test_return_value()
class VMOpsTestCase(*args, **kwargs)

Bases: nova.test.TestCase

test_check_resize_func_name_defaults_to_VDI_resize()
test_finish_revert_migration_after_crash()
test_finish_revert_migration_after_crash_before_backup()
test_finish_revert_migration_after_crash_before_new()
class XenAPIAggregateTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for aggregate operations.

setUp()
test_add_aggregate_host_raise_err()
test_add_host_to_aggregate_invalid_changing_status()

Ensure InvalidAggregateAction is raised when adding host while aggregate is not ready.

test_add_host_to_aggregate_invalid_dismissed_status()

Ensure InvalidAggregateAction is raised when aggregate is deleted.

test_add_host_to_aggregate_invalid_error_status()

Ensure InvalidAggregateAction is raised when aggregate is in error.

test_add_to_aggregate_first_host()
test_add_to_aggregate_for_first_host_sets_metadata()
test_join_slave()
test_pool_add_to_aggregate_called_by_driver()
test_pool_remove_from_aggregate_called_by_driver()
test_remote_master_non_empty_pool()
test_remove_from_aggregate_called()
test_remove_from_empty_aggregate()
test_remove_host_from_aggregate_error()
test_remove_host_from_aggregate_invalid_changing_status()

Ensure InvalidAggregateAction is raised when aggregate is changing.

test_remove_host_from_aggregate_invalid_dismissed_status()

Ensure InvalidAggregateAction is raised when aggregate is deleted.

test_remove_master_solo()
test_remove_slave()
class XenAPIAutoDiskConfigTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

assertIsPartitionCalled(called)
setUp()
test_instance_auto_disk_config_doesnt_pass_fail_safes(*args, **kwargs)
test_instance_auto_disk_config_passes_fail_safes(*args, **kwargs)

Should partition if instance is marked as auto_disk_config=True and virt-layer specific fail-safe checks pass.

test_instance_not_auto_disk_config()

Should not partition unless instance is marked as auto_disk_config.

class XenAPIBWCountersTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

FAKE_VMS = {'test1:ref': {'_vifmap': {'1': 'e:f:12:q...', '0': 'a:b:c:d...'}, 'name_label': 'test1', 'domid': '12', 'other_config': {'nova_uuid': 'hash'}}, 'test2:ref': {'_vifmap': {'1': 'e:f:42:q...', '0': 'a:3:c:d...'}, 'name_label': 'test2', 'domid': '42', 'other_config': {'nova_uuid': 'hash'}}}
setUp()
test_get_all_bw_counters()
test_get_all_bw_counters_in_failure_case()

Test that get_all_bw_conters returns an empty list when no data returned from Xenserver. c.f. bug #910045.

class XenAPIDetermineDiskImageTestCase(*args, **kwargs)

Bases: nova.test.TestCase

Unit tests for code that detects the ImageType.

assert_disk_type(image_meta, expected_disk_type)
test_machine()
test_none()
test_raw()
test_vhd()
class XenAPIDetermineIsPVTestCase(*args, **kwargs)

Bases: nova.test.TestCase

Unit tests for code that detects the PV status based on ImageType.

assert_pv_status(disk_image_type, os_type, expected_pv_status)
test_disk()
test_iso()
test_linux_vhd()
test_none(*args, **kwargs)
test_raw(*args, **kwargs)
test_windows_vhd()
class XenAPIDiffieHellmanTestCase(*args, **kwargs)

Bases: nova.test.TestCase

Unit tests for Diffie-Hellman code.

setUp()
test_encrypt_many_newlines_at_end()
test_encrypt_message_with_newlines_at_end()
test_encrypt_newlines_inside_message()
test_encrypt_really_long_message()
test_encrypt_simple_message()
test_encrypt_with_leading_newlines()
test_shared()
class XenAPIDom0IptablesFirewallTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

setUp()
test_do_refresh_security_group_rules()
test_filters_for_instance_with_ip_v6()
test_filters_for_instance_without_ip_v6()
test_multinic_iptables()
test_provider_firewall_rules()
test_static_filters()
class XenAPIGenerateLocal(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Test generating of local disks, like swap and ephemeral.

assertCalled(instance)
setUp()
test_generate_ephemeral()
test_generate_swap()
class XenAPIHostTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Tests HostState, which holds metrics from XenServer that get reported back to the Schedulers.

setUp()
test_get_host_uptime()
test_host_maintenance_off()
test_host_maintenance_on()
test_host_reboot()
test_host_shutdown()
test_host_startup()
test_host_state()
test_host_state_missing_sr()
test_set_enable_host_disable()
test_set_enable_host_enable()
test_supported_instances_is_calculated_by_to_supported_instances()
test_supported_instances_is_included_in_host_state()
class XenAPIImageTypeTestCase(*args, **kwargs)

Bases: nova.test.TestCase

Test ImageType class.

test_get_image_role_disk()
test_get_image_role_disk_raw()
test_get_image_role_disk_vhd()
test_get_image_role_kernel()
test_get_image_role_ramdisk()
test_to_string()
class XenAPIInjectMetadataTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

setUp()
test_change_instance_metadata_add()
test_change_instance_metadata_delete()
test_change_instance_metadata_update()
test_inject_instance_metadata()
class XenAPILiveMigrateTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for live_migration.

setUp()
test_check_can_live_migrate_destination_block_migration_fails()
test_check_can_live_migrate_destination_with_block_migration()
test_check_can_live_migrate_fails()
test_check_can_live_migrate_source_with_block_migrate()
test_check_can_live_migrate_source_with_block_migrate_fails()
test_check_can_live_migrate_works()
test_generate_vdi_map()
test_live_migrate_block_migration_xapi_call_parameters()
test_live_migration()
test_live_migration_calls_post_migration()
test_live_migration_calls_vmops()
test_live_migration_on_failure()
test_live_migration_with_block_migration_fails_migrate_send()
test_live_migration_with_block_migration_raises_invalid_param()
test_post_live_migration_at_destination()
test_pre_live_migration()
class XenAPIMigrateInstance(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit test for verifying migration-related actions.

setUp()
test_finish_migrate()
test_finish_migrate_no_local_storage()
test_finish_migrate_no_resize_vdi()
test_migrate_disk_and_power_off()
test_migrate_disk_and_power_off_passes_exceptions()
test_migrate_no_auto_disk_config_no_resize_down()
test_resize_xcp()
test_resize_xenserver_6()
test_revert_migrate()
class XenAPISRSelectionTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for testing we find the right SR.

test_safe_find_sr_by_other_criteria()
test_safe_find_sr_default()
test_safe_find_sr_local_storage()
test_safe_find_sr_raise_exception()
class XenAPISessionTestCase(*args, **kwargs)

Bases: nova.test.TestCase

test_get_product_version_product_brand_does_not_fail()
test_get_product_version_product_brand_xs_6()
class XenAPIVMTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for VM operations.

check_vm_params_for_linux()
check_vm_params_for_linux_with_external_kernel()
check_vm_params_for_windows()
check_vm_record(conn, check_injection=False)
create_vm_record(conn, os_type, name)
setUp()
tearDown()
test_finish_revert_migration()
test_get_diagnostics()
test_get_rrd_server()
test_init_host()
test_instance_snapshot()
test_instance_snapshot_fails_with_no_primary_vdi()
test_list_instance_uuids()
test_list_instance_uuids_0()
test_list_instances_0()
test_maintenance_mode()
test_maintenance_mode_no_aggregate()
test_maintenance_mode_no_host()
test_per_instance_usage_halted()
test_per_instance_usage_running()
test_per_instance_usage_suspended()
test_reboot_halted()
test_reboot_hard()
test_reboot_soft()
test_reboot_unknown_state()
test_rescue()
test_session_virtapi()
test_spawn_boot_from_volume_no_image_meta()
test_spawn_boot_from_volume_with_image_meta()
test_spawn_empty_dns()
test_spawn_fail_cleanup_1()

Simulates an error while downloading an image.

Verifies that the VM and VDIs created are properly cleaned up.

test_spawn_fail_cleanup_2()

Simulates an error while creating VM record.

Verifies that the VM and VDIs created are properly cleaned up.

test_spawn_fail_cleanup_3()

Simulates an error while attaching disks.

Verifies that the VM and VDIs created are properly cleaned up.

test_spawn_glance()
test_spawn_injected_files()
test_spawn_iso_glance()
test_spawn_netinject_file()
test_spawn_netinject_xenstore()
test_spawn_not_enough_memory()
test_spawn_raw_glance(*args, **kwargs)
test_spawn_ssh_key_injection()
test_spawn_vhd_glance_linux()
test_spawn_vhd_glance_windows()
test_spawn_vlanmanager()
test_spawn_with_network_qos()
test_unrescue()
test_unrescue_not_in_rescue()
class XenAPIVolumeTestCase(*args, **kwargs)

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for Volume operations.

setUp()
test_attach_volume()
test_attach_volume_raise_exception()
test_get_device_number_raise_exception_on_wrong_mountpoint()
test_mountpoint_to_number()
test_parse_volume_info_parsing_auth_details()
create_instance_with_system_metadata(context, instance_values)
get_fake_device_info()
set_image_fixtures()
stub_vm_utils_with_vdi_attached_here(function, should_return=True)

vm_utils.with_vdi_attached_here needs to be stubbed out because it calls down to the filesystem to attach a vdi. This provides a decorator to handle that.

Previous topic

The nova.tests.test_wsgi Module

Next topic

The nova.tests.utils Module

This Page