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(read_only=False)
Bases: nova.virt.driver.ComputeDriver
Fake hypervisor driver
-
FakeDriver.attach_volume(connection_info, instance_name, mountpoint)
Attach the disk to the instance at mountpoint using info
-
FakeDriver.block_stats(instance_name, disk_id)
-
FakeDriver.confirm_migration(migration, instance, network_info)
-
FakeDriver.destroy(instance, network_info, block_device_info=None)
-
FakeDriver.detach_volume(connection_info, instance_name, 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_usage(instances, start_time, stop_time=None)
Return bandwidth usage info for each interface on each
running VM
-
FakeDriver.get_available_resource()
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_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.interface_stats(instance_name, iface_id)
-
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)
-
FakeDriver.poll_rescued_instances(timeout)
-
FakeDriver.power_off(instance)
-
FakeDriver.power_on(instance)
-
FakeDriver.pre_live_migration(context, instance_ref, block_device_info, network_info)
-
FakeDriver.reboot(instance, network_info, reboot_type, block_device_info=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.resume(instance)
-
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)
-
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)
-
FakeDriver.update_host_status()
Return fake Host Status of ram, disk, network.
-
class FakeInstance(name, state)
Bases: object
Fake LDAP server for test harness.
This class does very little error checking, and knows nothing about ldap
class definitions. It implements the minimum emulation of the python ldap
library to work with nova.
-
class FakeLDAP
Bases: object
Fake LDAP connection.
-
FakeLDAP.add_s(dn, attr)
Add an object with the specified attributes at dn.
-
FakeLDAP.delete_s(dn)
Remove the ldap object at specified dn.
-
FakeLDAP.modify_s(dn, attrs)
Modify the object at dn using the attribute list.
-
FakeLDAP.modrdn_s(dn, newrdn)
-
FakeLDAP.search_s(dn, scope, query=None, fields=None)
Search for all matching objects under dn using the query.
Args:
dn – dn to search under
scope – only SCOPE_BASE and SCOPE_SUBTREE are supported
query – query to filter objects by
fields – fields to return. Returns all fields if not specified
-
FakeLDAP.simple_bind_s(dn, password)
This method is ignored, but provided for compatibility.
-
FakeLDAP.unbind_s()
This method is ignored, but provided for compatibility.
-
exception NO_SUCH_OBJECT
Bases: exceptions.Exception
Duplicate exception class from real LDAP module.
-
exception OBJECT_CLASS_VIOLATION
Bases: exceptions.Exception
Duplicate exception class from real LDAP module.
-
exception SERVER_DOWN
Bases: exceptions.Exception
Duplicate exception class from real LDAP module.
-
class Store
Bases: object
-
classmethod Store.instance()
-
initialize(_uri)
Opens a fake connection with an LDAP server.
The nova.volume.driver.FakeAOEDriver Class
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, 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_get_all(self)
-
stub_snapshot_get_all_by_project(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)