The nova.tests.compute.test_compute Module

Tests for compute service.

class BaseTestCase(*args, **kwargs)

Bases: nova.test.TestCase

setUp()
stub_out_client_exceptions()
tearDown()
class ComputeAPIAggrTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

This is for unit coverage of aggregate-related methods defined in nova.compute.api.

setUp()
test_add_host_to_aggregate()
test_add_host_to_aggregate_multiple()
test_add_host_to_aggregate_raise_not_found()
test_aggregate_no_zone()
test_delete_aggregate()
test_delete_non_empty_aggregate()
test_remove_host_from_aggregate_active()
test_remove_host_from_aggregate_raise_not_found()
test_update_aggregate_metadata()
class ComputeAPITestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

setUp()
test_add_remove_fixed_ip()
test_add_remove_security_group()
test_allow_confirm_resize_on_instance_in_deleting_task_state()
test_attach_interface()
test_attach_volume()
test_attach_volume_invalid()
test_attach_volume_no_device()
test_backup()
test_backup_conflict()
test_backup_image_creation_fails()
test_backup_image_show_fails()
test_console_output()
test_console_output_no_host()
test_create_instance_associates_security_groups()
test_create_instance_defaults_display_name()
test_create_instance_sets_system_metadata()
test_create_instance_with_invalid_security_group_raises()
test_create_just_enough_ram_and_disk()
test_create_saves_type_in_system_metadata()
test_create_with_base64_user_data()
test_create_with_large_user_data()
test_create_with_malformed_user_data()
test_create_with_no_ram_and_disk_reqs()
test_create_with_too_little_disk()
test_create_with_too_little_ram()
test_default_hostname_generator()
test_delete()
test_delete_fail()
test_delete_fast_if_host_not_set()
test_delete_handles_host_setting_race_condition()
test_delete_in_resized()
test_delete_in_resizing()
test_delete_soft()
test_delete_soft_fail()
test_delete_soft_rollback()
test_delete_with_down_host()
test_destroy_instance_disassociates_security_groups()
test_destroy_security_group_disassociates_instances()
test_detach_interface()
test_detach_invalid_volume()
test_detach_volume()
test_detach_volume_libvirt_is_down()
test_disallow_metadata_changes_during_building()
test_evacuate()
test_fail_evacuate_from_non_existing_host()
test_fail_evacuate_from_running_host()
test_fail_evacuate_instance_in_wrong_state()
test_force_delete()
test_get()
test_get_all_by_flavor()
test_get_all_by_image()
test_get_all_by_metadata()
test_get_all_by_multiple_options_at_once()
test_get_all_by_name_regexp()
test_get_all_by_state()
test_get_backdoor_port()
test_get_diagnostics()
test_get_instance_faults()
test_get_lock()
test_get_spice_console_no_host()
test_get_vnc_console_no_host()
test_get_with_admin_context()
test_get_with_integer_id()
test_hard_reboot_of_soft_rebooting_instance()
test_hostname_create()
test_inject_file()
test_inject_network_info()
test_instance_architecture()
test_instance_metadata()
test_instance_name_template()
test_instance_unknown_architecture()
test_live_migrate()
test_lock()
test_migrate()
test_multi_instance_display_name_template()
test_no_attach_volume_in_rescue_state()
test_no_detach_volume_in_rescue_state()
test_pause()
test_reboot_hard()
test_reboot_soft()
test_rebuild()
test_rebuild_no_image()
test_rescue_unrescue()
test_rescue_volume_backed()
test_reservation_id_one_instance()

Verify building an instance has a reservation_id that matches return value from create

test_reservation_ids_two_instances()

Verify building 2 instances at once results in a reservation_id being returned equal to reservation id set in both instances

test_reset_network()
test_resize_confirm_through_api()
test_resize_deleted_flavor_fails()
test_resize_invalid_flavor_fails()
test_resize_no_image()
test_resize_quota_exceeds_fails()
test_resize_request_spec()
test_resize_request_spec_noavoid()
test_resize_revert_deleted_flavor_fails()
test_resize_revert_through_api()
test_resize_same_flavor_fails()
test_restore()
test_resume()
test_secgroup_refresh()
test_secgroup_refresh_none()
test_secgroup_refresh_once()
test_secrule_refresh()
test_secrule_refresh_none()
test_secrule_refresh_once()
test_set_admin_password()
test_snapshot()
test_snapshot_conflict()
test_snapshot_given_image_uuid()

Ensure a snapshot of an instance can be created when image UUID is already known.

test_snapshot_image_creation_fails()
test_snapshot_image_metadata_inheritance()
test_snapshot_image_show_fails()
test_snapshot_minram_mindisk()

Ensure a snapshots min_ram and min_disk are correct.

A snapshot of an instance should have min_ram and min_disk set to that of the instances original image unless that image had a disk format of vhd.

test_snapshot_minram_mindisk_VHD()

Ensure a snapshots min_ram and min_disk are correct.

A snapshot of a non-shrinkable VHD should have min_disk set to that of the original instances flavor.

test_snapshot_minram_mindisk_img_missing_minram()

Ensure a snapshots min_ram and min_disk are correct.

Do not show an attribute that the orig img did not have.

test_snapshot_minram_mindisk_no_image()

Ensure a snapshots min_ram and min_disk are correct.

A snapshots min_ram and min_disk should be set to default if an instances original image cannot be found.

test_soft_reboot_of_rebooting_instance()
test_soft_reboot_of_rescued_instance()
test_spice_console()
test_start()
test_start_no_host()
test_start_shutdown()
test_stop()
test_stop_no_host()
test_suspend()
test_terminate_with_volumes()
test_unlock()
test_unpause()
test_update_block_device_mapping()
test_vnc_console()
test_volume_size()
class ComputeAggrTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

This is for unit coverage of aggregate-related methods defined in nova.compute.manager.

setUp()
test_add_aggregate_host()
test_add_aggregate_host_passes_slave_info_to_driver()
test_remove_aggregate_host()
test_remove_from_aggregate_passes_slave_info_to_driver()
class ComputeBackdoorPortTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

This is for unit test coverage of backdoor port rpc.

setUp()
test_get_backdoor_port()
class ComputeInactiveImageTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

setUp()
test_create_instance_with_deleted_image()
class ComputeInjectedFilesTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

setUp()
test_injected_empty()
test_injected_invalid()
test_injected_none()
test_injected_success()
test_reschedule()
class ComputePolicyTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

setUp()
test_actions_are_prefixed()
test_create_attach_network_fail()
test_create_attach_volume_fail()
test_create_fail()
test_force_host_fail()
test_force_host_pass()
test_get_all_fail()
test_get_fail()
test_get_instance_faults()
test_wrapped_method()
class ComputeRescheduleOrReraiseTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

Test logic and exception handling around rescheduling or re-raising original exceptions when builds fail.

setUp()
test_no_reschedule_on_delete_during_spawn()
test_no_reschedule_on_unexpected_task_state()
test_reschedule_fail()
test_reschedule_false()
test_reschedule_or_reraise_called()

Basic sanity check to make sure _reschedule_or_reraise is called when a build fails.

test_reschedule_true()
test_shutdown_instance_fail()

Test shutdown instance failing before re-scheduling logic can even run.

class ComputeRescheduleResizeOrReraiseTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

Test logic and exception handling around rescheduling prep resize requests

setUp()
test_reschedule_fails_with_exception()

Original exception should be raised if the _reschedule method raises another exception

test_reschedule_false()

Original exception should be raised if the resize is not rescheduled.

test_reschedule_resize_or_reraise_called()

Verify the rescheduling logic gets called when there is an error during prep_resize.

test_reschedule_true()
class ComputeReschedulingResizeTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.ComputeReschedulingTestCase

Test re-scheduling logic for prep_resize requests.

setUp()
class ComputeReschedulingTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

Tests re-scheduling logic for new build requests.

setUp()
test_reschedule_no_filter_properties()
test_reschedule_no_request_spec()
test_reschedule_no_retry_info()
test_reschedule_success()
class ComputeTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

test_add_fixed_ip_usage_notification()
test_add_instance_fault()
test_add_instance_fault_no_exc_info()
test_add_instance_fault_user_error()
test_add_instance_fault_with_remote_error()
test_add_remove_fixed_ip_updates_instance_updated_at()
test_can_terminate_on_error_state()
test_check_can_live_migrate_destination_fails_dest_check()
test_check_can_live_migrate_destination_fails_source()
test_check_can_live_migrate_destination_works_correctly()
test_check_can_live_migrate_source_works_correctly()
test_cleanup_running_deleted_instances()
test_cleanup_stored_instance_types_for_migration()
test_cleanup_stored_instance_types_for_migration_with_update()
test_cleanup_stored_instance_types_for_resize()
test_cleanup_stored_instance_types_for_resize_with_update()
test_console_output()
test_console_output_tail()
test_create_instance_associates_config_drive()
test_create_instance_no_image()
test_create_instance_unlimited_disk()
test_create_instance_unlimited_memory()
test_create_instance_with_img_ref_associates_config_drive()
test_create_instance_with_oversubscribed_cpu()
test_create_instance_with_oversubscribed_disk()
test_create_instance_with_oversubscribed_disk_fail()

Test passing of oversubscribed disk policy from the scheduler, but with insufficient disk.

test_create_instance_with_oversubscribed_ram()
test_create_instance_with_oversubscribed_ram_fail()

Test passing of oversubscribed ram policy from the scheduler, but with insufficient memory.

test_create_instance_without_node_param()
test_create_multiple_instances_then_starve()
test_default_access_ip()
test_delete_instance_deletes_console_auth_tokens()
test_delete_instance_deletes_console_auth_tokens_cells()
test_delete_instance_keeps_net_on_power_off_fail()
test_delete_instance_loses_net_on_other_fail()
test_delete_instance_succedes_on_volume_fail()
test_destroy_evacuated_instances()
test_diagnostics()
test_fail_to_schedule_persists()
test_finish_resize()
test_finish_resize_handles_error()
test_finish_resize_instance_notification()
test_finish_resize_with_volumes()

Contrived test to ensure finish_resize doesn’t raise anything.

test_finish_revert_resize()
test_get_by_flavor_id()
test_get_instance_nw_info()
test_get_instances_on_driver()
test_get_instances_on_driver_fallback()
test_get_resource_tracker_fail()
test_heal_instance_info_cache()
test_init_host()
test_init_host_with_deleted_migration()
test_init_instance_failed_resume_sets_error()
test_init_instance_reverts_crashed_migrations()
test_init_instance_update_nw_info_cache()

network_info is NetworkInfo list-like object.

test_init_instance_update_nw_info_cache_legacy()

network_info in legacy is form [(network_dict, info_dict)].

test_inject_file()
test_inject_network_info()
test_instance_build_timeout()
test_instance_build_timeout_disabled()
test_instance_build_timeout_mixed_instances()
test_instance_set_to_error_on_uncaught_exception()
test_instance_termination_exception_sets_error()

Test that we handle InstanceTerminationFailure which is propagated up from the underlying driver.

test_instance_update_host_check()
test_instance_usage_audit()
test_invalid_spice_console_type()
test_invalid_vnc_console_type()
test_live_migration_exception_rolls_back()
test_live_migration_works_correctly()
test_lock()
test_missing_spice_console_type()
test_missing_vnc_console_type()
test_network_is_deallocated_on_spawn_failure()
test_no_default_access_ip()
test_novnc_vnc_console()
test_pause()
test_poll_rescued_instances()
test_poll_unconfirmed_resizes()
test_post_live_migration_at_destination_with_compute_info()

The instance’s node property should be updated correctly.

test_post_live_migration_at_destination_without_compute_info()

The instance’s node property should be set to None if we fail to get compute_info.

test_post_live_migration_no_shared_storage_working_correctly()

Confirm post_live_migration() works correctly as expected for non shared storage migration.

test_post_live_migration_working_correctly()
test_power_off()
test_power_on()
test_pre_live_migration_instance_has_no_fixed_ip()
test_pre_live_migration_works_correctly()
test_prep_resize_instance_migration_error_on_none_host()

Ensure prep_resize raises a migration error if destination host is not defined

test_prep_resize_instance_migration_error_on_same_host()

Ensure prep_resize raise a migration error if destination is set on the same source host and allow_resize_to_same_host is false

test_quotas_destroy_of_soft_deleted_instance()
test_quotas_failed_delete()
test_quotas_failed_soft_delete()
test_quotas_succesful_delete()
test_quotas_succesful_soft_delete()
test_reboot_hard()
test_reboot_hard_and_delete()
test_reboot_hard_legacy_nwinfo_driver()
test_reboot_soft()
test_reboot_soft_and_delete()
test_reboot_soft_legacy_nwinfo_driver()
test_rebuild()
test_rebuild_instance_notification()
test_rebuild_launch_time()
test_rebuild_no_image()
test_reclaim_queued_deletes()
test_remove_fixed_ip_usage_notification()
test_rescue()
test_reset_network()
test_resize_instance()
test_resize_instance_driver_error()
test_resize_instance_handles_migration_error()
test_resize_instance_notification()
test_resize_same_source_fails()

Ensure instance fails to migrate when source and destination are the same host

test_run_instance_bails_on_missing_instance()
test_run_instance_dealloc_network_instance_not_found()

spawn network deallocate test.

Make sure that when an instance is not found during spawn that the network is deallocated

test_run_instance_existing()
test_run_instance_queries_macs()
test_run_instance_setup_block_device_mapping_fail()

block device mapping failure test.

Make sure that when there is a block device mapping problem, the instance goes to ERROR state, keeping the task state

test_run_instance_spawn_fail()

spawn failure test.

Make sure that when there is a spawning problem, the instance goes to ERROR state, keeping the task state

test_run_instance_usage_notification()
test_run_kill_vm()
test_run_terminate()
test_run_terminate_deallocate_net_failure_sets_error_state()
test_run_terminate_no_image()

Make sure instance started without image (from volume) can be termintad without issues

test_run_terminate_timestamps()
test_run_terminate_with_vol_attached()

Make sure it is possible to run and terminate instance with volume attached

test_running_deleted_instances()
test_set_admin_password()
test_set_admin_password_bad_state()
test_set_admin_password_driver_not_authorized()

Ensure expected exception is raised if set_admin_password not authorized.

test_set_admin_password_driver_not_implemented()

Ensure expected exception is raised if set_admin_password not implemented by driver.

test_snapshot()
test_snapshot_fails()
test_snapshot_no_image()
test_spice_console_instance_not_ready()
test_spicehtml5_spice_console()
test_start()
test_state_revert()
test_stop()
test_stop_start_no_image()
test_suspend()
test_suspend_error()
test_terminate_failure_leaves_task_state()

Ensure that a failure in terminate_instance does not result in the task state being reverted from DELETING (see LP 1046236).

test_terminate_no_network()
test_terminate_usage_notification()
test_validate_console_port_spice()
test_validate_console_port_vnc()
test_validate_console_port_wrong_port()
test_vnc_console_instance_not_ready()
test_wrap_instance_event()
test_wrap_instance_event_log_exception()
test_wrap_instance_fault()
test_wrap_instance_fault_instance_in_args()
test_wrap_instance_fault_no_instance()
test_xvpvnc_vnc_console()
class ComputeVolumeTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

setUp()
test_attach_volume_serial()
test_boot_volume_serial()
test_validate_bdm()
class DisabledInstanceTypesTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

Some instance-types are marked ‘disabled’ which means that they will not show up in customer-facing listings. We do, however, want those instance-types to be available for emergency migrations and for rebuilding of existing instances.

One legitimate use of the ‘disabled’ field would be when phasing out a particular instance-type. We still want customers to be able to use an instance that of the old type, and we want Ops to be able perform migrations against it, but we don’t want customers building new slices with ths phased-out instance-type.

setUp()
test_can_build_instance_from_visible_instance_type()
test_can_resize_to_visible_instance_type()
test_cannot_build_instance_from_disabled_instance_type()
test_cannot_resize_to_disabled_instance_type()
class EvacuateHostTestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

setUp()
tearDown()
test_driver_doesnt_support_recreate()
test_rebuild_on_host_instance_exists()

Rebuild if instance exists raises an exception.

test_rebuild_on_host_updated_target()

Confirm evacuate scenario updates host and node.

test_rebuild_on_host_updated_target_node_not_found()

Confirm evacuate scenario where compute_node isn’t found.

test_rebuild_on_host_with_shared_storage()

Confirm evacuate scenario on shared storage.

test_rebuild_on_host_with_volumes()

Confirm evacuate scenario reconnects volumes.

test_rebuild_on_host_without_shared_storage()

Confirm evacuate scenario without shared storage (rebuild from image)

test_rebuild_with_instance_in_stopped_state()

Confirm evacuate scenario updates vm_state to stopped if instance is in stopped state

test_rebuild_with_wrong_shared_storage()

Confirm evacuate scenario does not update host.

class FakeSchedulerAPI

Bases: object

live_migration(ctxt, block_migration, disk_over_commit, instance, dest)
prep_resize(ctxt, instance, instance_type, image, request_spec, filter_properties, reservations)
run_instance(ctxt, request_spec, admin_password, injected_files, requested_networks, is_first_time, filter_properties)
exception InnerTestingException

Bases: exceptions.Exception

class KeypairAPITestCase(*args, **kwargs)

Bases: nova.tests.compute.test_compute.BaseTestCase

setUp()
test_create_keypair()
test_create_keypair_already_exists()
test_create_keypair_invalid_chars()
test_create_keypair_name_too_long()
test_create_keypair_quota_limit()
test_get_keypair()
test_import_keypair()
test_import_keypair_bad_public_key()
test_import_keypair_invalid_chars()
test_import_keypair_name_too_long()
test_import_keypair_quota_limit()
fake_rpc_method(context, topic, msg, do_cast=True)
nop_report_driver_status(self)

Previous topic

The nova.tests.compute.test_claims Module

Next topic

The nova.tests.compute.test_compute_cells Module

This Page