This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

The nova.tests.api.openstack.test_servers Module

class nova.tests.api.openstack.test_servers.MockSetAdminPassword

Bases: object

class nova.tests.api.openstack.test_servers.ServerXMLSerializationTest(methodName='runTest')

Bases: nova.test.TestCase

setUp()
test_action()
test_create()
test_detail()
test_index()
test_show()
test_update()
class nova.tests.api.openstack.test_servers.ServersTest(methodName='runTest')

Bases: nova.test.TestCase

setUp()
test_create_backup_schedules()
test_create_instance()
test_create_instance_has_uuid()

Tests at the db-layer instead of API layer since that’s where the UUID is generated

test_create_instance_no_key_pair()
test_create_instance_no_name()
test_create_instance_no_server_entity()
test_create_instance_nonstring_name()
test_create_instance_v1_1()
test_create_instance_v1_1_admin_pass()
test_create_instance_v1_1_admin_pass_empty()
test_create_instance_v1_1_bad_flavor_href()
test_create_instance_v1_1_bad_href()
test_create_instance_v1_1_invalid_flavor_href()
test_create_instance_v1_1_invalid_flavor_id_int()
test_create_instance_v1_1_invalid_key_name()
test_create_instance_v1_1_local_href()
test_create_instance_v1_1_valid_key_name()
test_create_instance_via_zones()

Server generated ReservationID

test_create_instance_via_zones_with_resid()

User supplied ReservationID

test_create_instance_whitespace_name()
test_create_instance_with_access_ip_v1_1()
test_create_instance_with_admin_pass_v1_0()
test_create_instance_with_bad_config_drive_v1_1()
test_create_instance_with_config_drive_as_id_v1_1()
test_create_instance_with_config_drive_v1_1()
test_create_instance_without_config_drive_v1_1()
test_delete_backup_schedules()
test_delete_server_instance()
test_delete_server_instance_v1_1()
test_get_all_server_details_v1_0()
test_get_all_server_details_v1_1()
test_get_all_server_details_with_host()

We want to make sure that if two instances are on the same host, then they return the same hostId. If two instances are on different hosts, they should return different hostId’s. In this test, there are 5 instances - 2 on one host and 3 on another.

test_get_all_server_details_xml_v1_0()
test_get_server_addresses_nonexistant_network_v1_1()
test_get_server_addresses_nonexistant_server_v1_1()
test_get_server_addresses_private_v1_0()
test_get_server_addresses_private_xml_v1_0()
test_get_server_addresses_public_v1_0()
test_get_server_addresses_public_xml_v1_0()
test_get_server_addresses_single_network_v1_1()
test_get_server_addresses_v1_0()
test_get_server_addresses_v1_1()
test_get_server_addresses_xml_v1_0()
test_get_server_backup_schedule()
test_get_server_backup_schedules()
test_get_server_by_id()
test_get_server_by_id_malformed_networks_v1_1()
test_get_server_by_id_v1_1()
test_get_server_by_id_v1_1_xml()
test_get_server_by_id_with_addresses()
test_get_server_by_id_with_addresses_v1_1()
test_get_server_by_id_with_addresses_v1_1_ipv6_disabled()
test_get_server_by_id_with_addresses_xml()
test_get_server_by_uuid()

The steps involved with resolving a UUID are pretty complicated; here’s what’s happening in this scenario:

  1. Show is calling routing_get
  2. routing_get is wrapped by reroute_compute which does the work of resolving requests to child zones.
  3. reroute_compute looks up the UUID by hitting the stub (returns_server_by_uuid)
  4. Since the stub return that the record exists, reroute_compute considers the request to be ‘zone local’, so it replaces the UUID in the argument list with an integer ID and then calls the inner function (‘get’).
  5. The call to get hits the other stub ‘returns_server_by_id` which has the UUID set to FAKE_UUID

So, counterintuitively, we call get twice on the show command.

test_get_server_list()
test_get_server_list_v1_1()
test_get_server_list_with_reservation_id()
test_get_server_list_with_reservation_id_details()
test_get_server_list_with_reservation_id_empty()
test_get_server_with_active_status_by_id_v1_1()
test_get_server_with_id_image_ref_by_id_v1_1()
test_get_servers_admin_allows_ip6_v1_1()

Test getting servers by ip6 with admin_api enabled and admin context

test_get_servers_admin_allows_ip_v1_1()

Test getting servers by ip with admin_api enabled and admin context

test_get_servers_allows_changes_since_bad_value_v1_1()
test_get_servers_allows_changes_since_v1_1()
test_get_servers_allows_flavor_v1_1()
test_get_servers_allows_image_v1_1()
test_get_servers_allows_name_v1_1()
test_get_servers_allows_status_v1_1()
test_get_servers_invalid_status_v1_1()

Test getting servers by invalid status

test_get_servers_unknown_or_admin_options1()

Test getting servers by admin-only or unknown options. This tests when admin_api is off. Make sure the admin and unknown options are stripped before they get to compute_api.get_all()

test_get_servers_unknown_or_admin_options2()

Test getting servers by admin-only or unknown options. This tests when admin_api is on, but context is a user. Make sure the admin and unknown options are stripped before they get to compute_api.get_all()

test_get_servers_unknown_or_admin_options3()

Test getting servers by admin-only or unknown options. This tests when admin_api is on and context is admin. All options should be passed through to compute_api.get_all()

test_get_servers_with_bad_limit()
test_get_servers_with_bad_marker()
test_get_servers_with_bad_offset()
test_get_servers_with_bad_option_v1_0()
test_get_servers_with_bad_option_v1_1()
test_get_servers_with_limit()
test_get_servers_with_limit_and_marker()
test_get_servers_with_limit_and_offset()
test_get_servers_with_marker()
test_get_servers_with_offset()
test_rescue_accepted()
test_rescue_raises_handled()
test_server_actions()
test_server_backup_schedule_deprecated_v1_1()
test_server_diagnostics()
test_server_inject_network_info()
test_server_pause()
test_server_reset_network()
test_server_resume()
test_server_suspend()
test_server_unpause()
test_tenant_id_filter_converts_to_project_id_for_admin()
test_update_nonstring_name()

Confirm that update is filtering params

test_update_null_name()

Confirm that update is filtering params

test_update_server_access_ipv4_v1_1()
test_update_server_access_ipv6_v1_1()
test_update_server_adminPass_ignored_v1_1()
test_update_server_all_attributes_v1_1()
test_update_server_name_v1_1()
test_update_server_no_body()
test_update_server_no_body_v1_1()
test_update_server_v1_0()
test_update_whitespace_name()

Confirm that update is filtering params

class nova.tests.api.openstack.test_servers.ServersViewBuilderV11Test(methodName='runTest')

Bases: nova.test.TestCase

setUp()
tearDown()
test_build_server()
test_build_server_detail()
test_build_server_detail_active_status()
test_build_server_detail_with_accessipv4()
test_build_server_detail_with_accessipv6()
test_build_server_detail_with_metadata()
test_build_server_with_project_id()
class nova.tests.api.openstack.test_servers.TestAddressesXMLSerialization(methodName='runTest')

Bases: nova.test.TestCase

test_index()
test_show()
class nova.tests.api.openstack.test_servers.TestGetKernelRamdiskFromImage(methodName='runTest')

Bases: nova.test.TestCase

If we’re building from an AMI-style image, we need to be able to fetch the kernel and ramdisk associated with the machine image. This information is stored with the image metadata and return via the ImageService.

These tests ensure that we parse the metadata return the ImageService correctly and that we handle failure modes appropriately.

test_ami_kernel_ramdisk_present()

Return IDs if both kernel and ramdisk are present

test_ami_no_kernel()

If an ami is missing a kernel it should raise NotFound

test_ami_no_ramdisk()

If an ami is missing a ramdisk, return kernel ID and None for ramdisk ID

test_not_ami()

Anything other than ami should return no kernel and no ramdisk

test_status_not_active()

We should only allow fetching of kernel and ramdisk information if we have a ‘fully-formed’ image, aka ‘active’

class nova.tests.api.openstack.test_servers.TestServerCreateRequestXMLDeserializerV10(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_canonical_request_from_docs()
test_minimal_request()
test_request_second_personality_node_ignored()
test_request_with_empty_metadata()
test_request_with_empty_metadata_and_personality()
test_request_with_empty_metadata_and_personality_reversed()
test_request_with_empty_personality()
test_request_with_metadata_duplicate_key()
test_request_with_metadata_missing_key()
test_request_with_metadata_missing_value()
test_request_with_one_metadata()
test_request_with_one_personality()
test_request_with_one_personality_empty_contents()
test_request_with_one_personality_empty_contents_variation()
test_request_with_one_personality_missing_path()
test_request_with_two_metadata()
test_request_with_two_metadata_missing_key()
test_request_with_two_metadata_missing_value()
test_request_with_two_personalities()
class nova.tests.api.openstack.test_servers.TestServerCreateRequestXMLDeserializerV11(methodName='runTest')

Bases: nova.test.TestCase

setUp()
test_access_ip()
test_access_ipv4()
test_access_ipv6()
test_admin_pass()
test_empty_metadata_personality()
test_minimal_request()
test_multiple_metadata_items()
test_multiple_personality_files()
test_request_with_empty_networks()
test_request_with_networks_duplicate_ids()
test_request_with_one_network()
test_request_with_one_network_empty_fixed_ip()
test_request_with_one_network_empty_id()
test_request_with_one_network_missing_fixed_ip()
test_request_with_one_network_missing_id()
test_request_with_second_network_node_ignored()
test_request_with_two_networks()
test_spec_request()
class nova.tests.api.openstack.test_servers.TestServerInstanceCreation(methodName='runTest')

Bases: nova.test.TestCase

setUp()
test_create_instance_admin_pass_json()
test_create_instance_admin_pass_xml()
test_create_instance_personality_empty_content()
test_create_instance_with_no_personality()
test_create_instance_with_no_personality_xml()
test_create_instance_with_null_personality()
test_create_instance_with_personality()
test_create_instance_with_personality_no_contents()
test_create_instance_with_personality_no_path()
test_create_instance_with_personality_not_a_list()
test_create_instance_with_personality_with_non_b64_content()
test_create_instance_with_personality_xml()
test_create_instance_with_three_personalities()
class nova.tests.api.openstack.test_servers.TestServerStatus(methodName='runTest')

Bases: nova.test.TestCase

test_active()
test_password_update()
test_reboot()
test_rebuild()
test_rebuild_error()
test_resize()
test_stopped()
test_verify_resize()
nova.tests.api.openstack.test_servers.fake_compute_api(cls, req, id)
nova.tests.api.openstack.test_servers.fake_gen_uuid()
nova.tests.api.openstack.test_servers.find_host(self, context, instance_id)
nova.tests.api.openstack.test_servers.instance_addresses(context, instance_id)
nova.tests.api.openstack.test_servers.instance_update(context, instance_id, values)
nova.tests.api.openstack.test_servers.return_security_group(context, instance_id, security_group_id)
nova.tests.api.openstack.test_servers.return_server_by_id(context, id)
nova.tests.api.openstack.test_servers.return_server_by_uuid(context, uuid)
nova.tests.api.openstack.test_servers.return_server_with_addresses(private, public)
nova.tests.api.openstack.test_servers.return_server_with_attributes(**kwargs)
nova.tests.api.openstack.test_servers.return_server_with_state(vm_state, task_state=None)
nova.tests.api.openstack.test_servers.return_server_with_uuid_and_state(vm_state, task_state)
nova.tests.api.openstack.test_servers.return_servers(context, *args, **kwargs)
nova.tests.api.openstack.test_servers.return_servers_by_reservation(context, reservation_id='')
nova.tests.api.openstack.test_servers.return_servers_by_reservation_empty(context, reservation_id='')
nova.tests.api.openstack.test_servers.return_servers_from_child_zones(*args, **kwargs)
nova.tests.api.openstack.test_servers.return_servers_from_child_zones_empty(*args, **kwargs)
nova.tests.api.openstack.test_servers.return_virtual_interface_by_instance(interfaces)
nova.tests.api.openstack.test_servers.return_virtual_interface_instance_nonexistant(interfaces)
nova.tests.api.openstack.test_servers.stub_instance(id, user_id='fake', project_id='fake', private_address=None, public_addresses=None, host=None, vm_state=None, task_state=None, reservation_id='', uuid='aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', image_ref='10', flavor_id='1', interfaces=None, name=None, key_name='', access_ipv4=None, access_ipv6=None)