The nova.tests.test_xenapi Module

Test suite for XenAPI.

class Aggregate(id=None, hosts=None)

Bases: object

class CompareVersionTestCase(methodName='runTest')

Bases: nova.test.TestCase

test_equal()

Test that cmp_version compares a as equal to b

test_greater_than()

Test that cmp_version compares a as greater than b

test_length()

Test that cmp_version compares by length as last resort

test_less_than()

Test that cmp_version compares a as less than b

test_non_lexical()

Test that cmp_version compares non-lexically

class HypervisorPoolTestCase(methodName='runTest')

Bases: nova.test.TestCase

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_id, 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(methodName='runTest')

Bases: nova.test.TestCase

test_no_path()
test_no_port()
test_swapping()
class ToSupportedInstancesTestCase(methodName='runTest')

Bases: nova.test.TestCase

test_default_return_value()
test_invalid_values_do_not_break()
test_multiple_values()
test_return_value()
class VMOpsTestCase(methodName='runTest')

Bases: nova.test.TestCase

test_check_resize_func_name_defaults_to_VDI_resize()
class VmUtilsTestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit tests for xenapi utils.

test_upload_image()

Ensure image properties include instance system metadata as well as few local settings.

class XenAPIAggregateTestCase(methodName='runTest')

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for aggregate operations.

setUp()
test_add_aggregate_host_raise_err()

Ensure the undo operation works correctly on add.

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()

Ensure join_slave gets called when the request gets to master.

test_pool_add_to_aggregate_called_by_driver()
test_pool_remove_from_aggregate_called_by_driver()
test_remote_master_non_empty_pool()

Ensure AggregateError is raised if removing the master.

test_remove_from_aggregate_called()
test_remove_from_empty_aggregate()
test_remove_host_from_aggregate_error()

Ensure we can remove a host from an aggregate even if in 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()

Ensure metadata are cleared after removal.

test_remove_slave()

Ensure eject slave gets called.

class XenAPIAutoDiskConfigTestCase(methodName='runTest')

Bases: nova.tests.xenapi.stubs.XenAPITestBase

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

Should not partition unless fail safes pass

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 XenAPIBWUsageTestCase(methodName='runTest')

Bases: nova.tests.xenapi.stubs.XenAPITestBase

setUp()
test_get_all_bw_usage_in_failure_case()

Test that get_all_bw_usage returns an empty list when metrics compilation failed. c.f. bug #910045.

class XenAPIDetermineDiskImageTestCase(methodName='runTest')

Bases: nova.test.TestCase

Unit tests for code that detects the ImageType.

assert_disk_type(image_meta, expected_disk_type)
test_machine()
test_raw()
test_vhd()
class XenAPIDiffieHellmanTestCase(methodName='runTest')

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(methodName='runTest')

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(methodName='runTest')

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Test generating of local disks, like swap and ephemeral

assertCalled(instance)
setUp()
test_generate_ephemeral()

Test ephemeral disk generation.

test_generate_swap()

Test swap disk generation.

class XenAPIHostTestCase(methodName='runTest')

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_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(methodName='runTest')

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()

Can convert from type id to type string.

class XenAPIInjectMetadataTestCase(methodName='runTest')

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(methodName='runTest')

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(methodName='runTest')

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_resize_xcp()
test_resize_xenserver_6()
test_revert_migrate()
class XenAPISRSelectionTestCase(methodName='runTest')

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for testing we find the right SR.

test_safe_find_sr_by_other_criteria()

Ensure the SR is found when using a different filter.

test_safe_find_sr_default()

Ensure the default SR is found regardless of other-config.

test_safe_find_sr_local_storage()

Ensure the default local-storage is found.

test_safe_find_sr_raise_exception()

Ensure StorageRepositoryNotFound is raise when wrong filter.

class XenAPISessionTestCase(methodName='runTest')

Bases: nova.test.TestCase

test_get_product_version_product_brand_does_not_fail()
test_get_product_version_product_brand_xs_6()
class XenAPIVMTestCase(methodName='runTest')

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_instances_0()
test_reboot_halted()
test_reboot_hard()
test_reboot_soft()
test_reboot_unknown_state()
test_rescue()
test_spawn_empty_dns()

Test spawning with an empty dns list

test_spawn_fail_cleanup_1()

Simulates an error while downloading an image.

Verifies that VDIs created are properly cleaned up.

test_spawn_fail_cleanup_2()

Simulates an error while creating VM record.

It verifies that VDIs created are properly cleaned up.

test_spawn_glance()
test_spawn_injected_files()

Test spawning with 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_vhd_glance_linux()
test_spawn_vhd_glance_swapdisk()
test_spawn_vhd_glance_windows()
test_spawn_vlanmanager()
test_spawn_with_network_qos()
test_unrescue()
test_unrescue_not_in_rescue()
class XenAPIVolumeTestCase(methodName='runTest')

Bases: nova.tests.xenapi.stubs.XenAPITestBase

Unit tests for Volume operations.

setUp()
test_attach_volume()

This shows how to test Ops classes’ methods.

test_attach_volume_raise_exception()

This shows how to test when exceptions are raised.

test_mountpoint_to_number()
test_parse_volume_info_raise_exception()

This shows how to test helper classes’ methods.

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.test_xensm Module

This Page