Fake Drivers
Todo
document general info about fakes
When the real thing isn’t available and you have some development to do these
fake implementations of various drivers let you get on with your day.
A fake (in-memory) hypervisor+api.
Allows nova testing w/o a hypervisor. This module also documents the
semantics of real hypervisor connections.
-
class FakeDriver(virtapi, read_only=False)
Bases: nova.virt.driver.ComputeDriver
-
FakeDriver.attach_interface(instance, image_meta, network_info)
-
FakeDriver.attach_volume(connection_info, instance, mountpoint)
Attach the disk to the instance at mountpoint using info.
-
FakeDriver.block_stats(instance_name, disk_id)
-
FakeDriver.capabilities = {'supports_recreate': True, 'has_imagecache': True}
Fake hypervisor driver.
-
FakeDriver.check_can_live_migrate_destination(ctxt, instance_ref, src_compute_info, dst_compute_info, block_migration=False, disk_over_commit=False)
-
FakeDriver.check_can_live_migrate_destination_cleanup(ctxt, dest_check_data)
-
FakeDriver.check_can_live_migrate_source(ctxt, instance_ref, dest_check_data)
-
FakeDriver.confirm_migration(migration, instance, network_info)
-
FakeDriver.destroy(instance, network_info, block_device_info=None, destroy_disks=True)
-
FakeDriver.detach_interface(instance, network_info)
-
FakeDriver.detach_volume(connection_info, instance, mountpoint)
Detach the disk attached to the instance.
-
FakeDriver.ensure_filtering_rules_for_instance(instance_ref, network_info)
This method is supported only by libvirt.
-
FakeDriver.finish_migration(context, migration, instance, disk_info, network_info, image_meta, resize_instance, block_device_info=None)
-
FakeDriver.finish_revert_migration(instance, network_info, block_device_info=None)
-
FakeDriver.get_all_bw_counters(instances)
Return bandwidth usage counters for each interface on each
running VM
-
FakeDriver.get_all_volume_usage(context, instances, start_time, stop_time=None)
Return usage info for volumes attached to vms on
a given host
-
FakeDriver.get_available_nodes()
-
FakeDriver.get_available_resource(nodename)
Updates compute manager resource info on ComputeNode table.
Since we don’t have a real hypervisor, pretend we have lots of
disk and ram.
-
FakeDriver.get_console_output(instance)
-
FakeDriver.get_console_pool_info(console_type)
-
FakeDriver.get_diagnostics(instance_name)
-
FakeDriver.get_disk_available_least()
-
static FakeDriver.get_host_ip_addr()
-
FakeDriver.get_host_stats(refresh=False)
Return fake Host Status of ram, disk, network.
-
FakeDriver.get_info(instance)
-
FakeDriver.get_instance_disk_info(instance_name)
-
FakeDriver.get_spice_console(instance)
-
FakeDriver.get_vnc_console(instance)
-
FakeDriver.get_volume_connector(instance)
-
FakeDriver.host_maintenance_mode(host, mode)
Start/Stop host maintenance window. On start, it triggers
guest VMs evacuation.
-
FakeDriver.host_power_action(host, action)
Reboots, shuts down or powers up the host.
-
FakeDriver.init_host(host)
-
FakeDriver.inject_file(instance, b64_path, b64_contents)
-
FakeDriver.instance_on_disk(instance)
-
FakeDriver.interface_stats(instance_name, iface_id)
-
FakeDriver.legacy_nwinfo()
-
FakeDriver.list_instance_uuids()
-
FakeDriver.list_instances()
-
FakeDriver.live_migration(context, instance_ref, dest, post_method, recover_method, block_migration=False, migrate_data=None)
-
FakeDriver.migrate_disk_and_power_off(context, instance, dest, instance_type, network_info, block_device_info=None)
-
FakeDriver.pause(instance)
-
FakeDriver.plug_vifs(instance, network_info)
Plug VIFs into networks.
-
FakeDriver.poll_rebooting_instances(timeout, instances)
-
FakeDriver.post_live_migration_at_destination(context, instance, network_info, block_migration=False, block_device_info=None)
-
FakeDriver.power_off(instance)
-
FakeDriver.power_on(context, instance, network_info, block_device_info)
-
FakeDriver.pre_live_migration(context, instance_ref, block_device_info, network_info, migrate_data=None)
-
FakeDriver.reboot(context, instance, network_info, reboot_type, block_device_info=None, bad_volumes_callback=None)
-
FakeDriver.refresh_instance_security_rules(instance)
-
FakeDriver.refresh_provider_fw_rules()
-
FakeDriver.refresh_security_group_members(security_group_id)
-
FakeDriver.refresh_security_group_rules(security_group_id)
-
FakeDriver.rescue(context, instance, network_info, image_meta, rescue_password)
-
FakeDriver.restore(instance)
-
FakeDriver.resume(instance, network_info, block_device_info=None)
-
FakeDriver.resume_state_on_host_boot(context, instance, network_info, block_device_info=None)
-
FakeDriver.set_admin_password(instance, new_pass)
-
FakeDriver.set_host_enabled(host, enabled)
Sets the specified host’s ability to accept new instances.
-
FakeDriver.snapshot(context, instance, name, update_task_state)
-
FakeDriver.soft_delete(instance)
-
FakeDriver.spawn(context, instance, image_meta, injected_files, admin_password, network_info=None, block_device_info=None)
-
FakeDriver.suspend(instance)
-
FakeDriver.test_remove_vm(instance_name)
Removes the named VM, as if it crashed. For testing.
-
FakeDriver.unfilter_instance(instance_ref, network_info)
This method is supported only by libvirt.
-
FakeDriver.unpause(instance)
-
FakeDriver.unplug_vifs(instance, network_info)
Unplug VIFs from networks.
-
FakeDriver.unrescue(instance, network_info)
-
class FakeInstance(name, state)
Bases: object
-
class FakeVirtAPI
Bases: nova.virt.virtapi.VirtAPI
-
FakeVirtAPI.agent_build_get_by_triple(context, hypervisor, os, architecture)
-
FakeVirtAPI.aggregate_get_by_host(context, host, key=None)
-
FakeVirtAPI.aggregate_metadata_add(context, aggregate, metadata, set_delete=False)
-
FakeVirtAPI.aggregate_metadata_delete(context, aggregate, key)
-
FakeVirtAPI.instance_get_all_by_host(context, host)
-
FakeVirtAPI.instance_get_by_uuid(context, instance_uuid)
-
FakeVirtAPI.instance_type_get(context, instance_type_id)
-
FakeVirtAPI.instance_update(context, instance_uuid, updates)
-
FakeVirtAPI.provider_fw_rule_get_all(context)
-
FakeVirtAPI.security_group_get_by_instance(context, instance)
-
FakeVirtAPI.security_group_rule_get_by_security_group(context, security_group)
-
restore_nodes()
Resets FakeDriver’s node list modified by set_nodes().
Usually called from tearDown().
-
set_nodes(nodes)
Sets FakeDriver’s node.list.
- It has effect on the following methods:
- get_available_nodes()
get_available_resource
get_host_stats()
To restore the change, call restore_nodes()
The nova.auth.fakeldap Module
The nova.tests.service_unittest.FakeManager Class
-
class Context
Bases: object
-
class FakeAuthDatabase
Bases: object
-
static FakeAuthDatabase.auth_token_create(context, token)
-
static FakeAuthDatabase.auth_token_destroy(context, token_id)
-
static FakeAuthDatabase.auth_token_get(context, token_hash)
-
FakeAuthDatabase.data = {}
-
class FakeRateLimiter(application)
Bases: object
-
class FakeRequestContext(*args, **kwargs)
Bases: nova.context.RequestContext
-
class FakeRouter(ext_mgr=None)
Bases: nova.wsgi.Router
-
class FakeToken(**kwargs)
Bases: object
-
FakeToken.id_count = 0
-
class HTTPRequest(*args, **kwargs)
Bases: nova.api.openstack.wsgi.Request
-
classmethod HTTPRequest.blank(*args, **kwargs)
-
class TestRouter(controller)
Bases: nova.wsgi.Router
-
create_info_cache(nw_cache)
-
fake_instance_get(**kwargs)
-
fake_instance_get_all_by_filters(num_servers=5, **kwargs)
-
get_fake_uuid(token=0)
-
stub_instance(id, user_id=None, project_id=None, host=None, node=None, vm_state=None, task_state=None, reservation_id='', uuid='aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', image_ref='10', flavor_id='1', name=None, key_name='', access_ipv4=None, access_ipv6=None, progress=0, auto_disk_config=False, display_name=None, include_fake_metadata=True, config_drive=None, power_state=None, nw_cache=None, metadata=None, security_groups=None, root_device_name=None, limit=None, marker=None)
-
class stub_out_compute_api_backup(stubs)
Bases: object
-
stub_out_compute_api_backup.backup(context, instance, name, backup_type, rotation, extra_properties=None)
-
stub_out_compute_api_snapshot(stubs)
-
stub_out_glance(stubs)
-
stub_out_glanceclient_create(stubs, sent_to_glance)
We return the metadata sent to glance by modifying the sent_to_glance dict
in place.
-
stub_out_instance_quota(stubs, allowed, quota, resource='instances')
-
stub_out_key_pair_funcs(stubs, have_key_pair=True)
-
stub_out_networking(stubs)
-
stub_out_nw_api(stubs, cls=None, private=None, publics=None)
-
stub_out_nw_api_get_floating_ips_by_fixed_address(stubs, func=None)
-
stub_out_nw_api_get_instance_nw_info(stubs, num_networks=1, func=None)
-
stub_out_rate_limiting(stubs)
-
stub_snapshot(id, **kwargs)
-
stub_snapshot_create(self, context, volume_id, name, description)
-
stub_snapshot_delete(self, context, snapshot)
-
stub_snapshot_get(self, context, snapshot_id)
-
stub_snapshot_get_all(self, context)
-
stub_volume(id, **kwargs)
-
stub_volume_create(self, context, size, name, description, snapshot, **param)
-
stub_volume_create_from_image(self, context, size, name, description, snapshot, volume_type, metadata, availability_zone)
-
stub_volume_delete(self, context, *args, **param)
-
stub_volume_get(self, context, volume_id)
-
stub_volume_get_all(context, search_opts=None)
-
stub_volume_get_all_by_project(self, context, search_opts=None)
-
stub_volume_get_notfound(self, context, volume_id)
-
stub_volume_update(self, context, *args, **param)
-
wsgi_app(inner_app_v2=None, fake_auth_context=None, use_no_auth=False, ext_mgr=None, init_only=None)