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 nova.virt.fake.FakeConnection
Bases: nova.virt.driver.ComputeDriver
Fake hypervisor driver
-
FakeConnection.agent_update(instance, url, md5hash)
-
FakeConnection.attach_volume(instance_name, device_path, mountpoint)
-
FakeConnection.block_stats(instance_name, disk_id)
-
FakeConnection.compare_cpu(xml)
This method is supported only by libvirt.
-
FakeConnection.destroy(instance, network_info, cleanup=True)
-
FakeConnection.detach_volume(instance_name, mountpoint)
-
FakeConnection.ensure_filtering_rules_for_instance(instance_ref, network_info)
This method is supported only by libvirt.
-
FakeConnection.get_ajax_console(instance)
-
FakeConnection.get_console_output(instance)
-
FakeConnection.get_console_pool_info(console_type)
-
FakeConnection.get_diagnostics(instance_name)
-
FakeConnection.get_host_ip_addr()
-
FakeConnection.get_host_stats(refresh=False)
Return fake Host Status of ram, disk, network.
-
FakeConnection.get_info(instance_name)
-
FakeConnection.get_vnc_console(instance)
-
FakeConnection.host_power_action(host, action)
Reboots, shuts down or powers up the host.
-
FakeConnection.init_host(host)
-
FakeConnection.inject_file(instance, b64_path, b64_contents)
-
classmethod FakeConnection.instance()
-
FakeConnection.interface_stats(instance_name, iface_id)
-
FakeConnection.list_disks(instance_name)
-
FakeConnection.list_instances()
-
FakeConnection.list_instances_detail()
-
FakeConnection.list_interfaces(instance_name)
-
FakeConnection.live_migration(context, instance_ref, dest, post_method, recover_method, block_migration=False)
This method is supported only by libvirt.
-
FakeConnection.migrate_disk_and_power_off(instance, dest)
-
FakeConnection.pause(instance, callback)
-
FakeConnection.poll_rescued_instances(timeout)
-
FakeConnection.reboot(instance, network_info)
-
FakeConnection.refresh_provider_fw_rules()
-
FakeConnection.refresh_security_group_members(security_group_id)
-
FakeConnection.refresh_security_group_rules(security_group_id)
-
FakeConnection.rescue(context, instance, callback, network_info)
-
FakeConnection.resize(instance, flavor)
-
FakeConnection.resume(instance, callback)
-
FakeConnection.set_admin_password(instance, new_pass)
-
FakeConnection.set_host_enabled(host, enabled)
Sets the specified host’s ability to accept new instances.
-
FakeConnection.snapshot(context, instance, name)
-
FakeConnection.spawn(context, instance, network_info=None, block_device_info=None)
-
FakeConnection.suspend(instance, callback)
-
FakeConnection.test_remove_vm(instance_name)
Removes the named VM, as if it crashed. For testing
-
FakeConnection.unfilter_instance(instance_ref, network_info)
This method is supported only by libvirt.
-
FakeConnection.unpause(instance, callback)
-
FakeConnection.unrescue(instance, callback, network_info)
-
FakeConnection.update_available_resource(ctxt, host)
This method is supported only by libvirt.
-
FakeConnection.update_host_status()
Return fake Host Status of ram, disk, network.
-
class nova.virt.fake.FakeInstance(name, state)
Bases: object
-
nova.virt.fake.get_connection(_)
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 nova.auth.fakeldap.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.
Args:
dn – a dn
attrs – a list of tuples in the following form:
([MOD_ADD | MOD_DELETE | MOD_REPACE], attribute, value)
-
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 nova.auth.fakeldap.NO_SUCH_OBJECT
Bases: exceptions.Exception
Duplicate exception class from real LDAP module.
-
exception nova.auth.fakeldap.OBJECT_CLASS_VIOLATION
Bases: exceptions.Exception
Duplicate exception class from real LDAP module.
-
exception nova.auth.fakeldap.SERVER_DOWN
Bases: exceptions.Exception
Duplicate exception class from real LDAP module.
-
class nova.auth.fakeldap.Store
Bases: object
-
classmethod Store.instance()
-
nova.auth.fakeldap.initialize(_uri)
Opens a fake connection with an LDAP server.
Based a bit on the carrot.backeds.queue backend... but a lot better.
-
class nova.fakerabbit.Backend(connection, **kwargs)
Bases: carrot.backends.base.BaseBackend
-
Backend.cancel(consumer_tag)
-
Backend.consume(limit=None)
-
Backend.declare_consumer(queue, callback, consumer_tag, *args, **kwargs)
-
Backend.exchange_declare(exchange, type, *args, **kwargs)
-
Backend.get(queue, no_ack=False)
-
Backend.prepare_message(message_data, delivery_mode, content_type, content_encoding, **kwargs)
Prepare message for sending.
-
Backend.publish(message, exchange, routing_key, **kwargs)
-
Backend.queue_bind(queue, exchange, routing_key, **kwargs)
-
Backend.queue_declare(queue, **kwargs)
-
class nova.fakerabbit.Exchange(name, exchange_type)
Bases: object
-
Exchange.bind(callback, routing_key)
-
Exchange.publish(message, routing_key=None)
-
class nova.fakerabbit.Message(backend, **kwargs)
Bases: carrot.backends.base.BaseMessage
-
class nova.fakerabbit.Queue(name)
Bases: object
-
Queue.pop()
-
Queue.push(message, routing_key=None)
-
Queue.size()
-
nova.fakerabbit.reset_all()
-
class nova.volume.driver.FakeAOEDriver(*args, **kwargs)
Bases: nova.volume.driver.AOEDriver
Logs calls instead of executing.
-
FakeAOEDriver.check_for_setup_error()
No setup necessary in fake mode.
-
static FakeAOEDriver.fake_execute(cmd, *_args, **_kwargs)
Execute that simply logs the command.
The nova.tests.service_unittest.FakeManager Class
-
class nova.tests.api.openstack.fakes.Context
Bases: object
-
class nova.tests.api.openstack.fakes.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)
-
class nova.tests.api.openstack.fakes.FakeAuthManager
Bases: object
-
FakeAuthManager.add_user(user)
-
classmethod FakeAuthManager.clear_fakes()
-
FakeAuthManager.create_project(name, manager_user, description=None, member_users=None)
-
FakeAuthManager.create_user(name, access=None, secret=None, admin=False)
-
FakeAuthManager.delete_project(pid)
-
FakeAuthManager.delete_user(uid)
-
FakeAuthManager.get_project(pid)
-
FakeAuthManager.get_projects(user_id=None)
-
FakeAuthManager.get_user(uid)
-
FakeAuthManager.get_user_from_access_key(key)
-
FakeAuthManager.get_users()
-
FakeAuthManager.is_admin(user_id)
-
FakeAuthManager.is_project_member(user_id, project)
-
FakeAuthManager.modify_project(project, manager_user=None, description=None)
-
FakeAuthManager.modify_user(user_id, access=None, secret=None, admin=None)
-
classmethod FakeAuthManager.reset_fake_data()
-
class nova.tests.api.openstack.fakes.FakeRateLimiter(application)
Bases: object
-
class nova.tests.api.openstack.fakes.FakeRequestContext(user, project, *args, **kwargs)
Bases: object
-
class nova.tests.api.openstack.fakes.FakeRouter
Bases: nova.wsgi.Router
-
class nova.tests.api.openstack.fakes.FakeToken(**kwargs)
Bases: object
-
nova.tests.api.openstack.fakes.fake_auth_init(self, application)
-
nova.tests.api.openstack.fakes.stub_out_auth(stubs)
-
nova.tests.api.openstack.fakes.stub_out_compute_api_backup(stubs)
-
nova.tests.api.openstack.fakes.stub_out_compute_api_snapshot(stubs)
-
nova.tests.api.openstack.fakes.stub_out_glance(stubs, initial_fixtures=None)
-
nova.tests.api.openstack.fakes.stub_out_glance_add_image(stubs, sent_to_glance)
We return the metadata sent to glance by modifying the sent_to_glance dict
in place.
-
nova.tests.api.openstack.fakes.stub_out_image_service(stubs)
-
nova.tests.api.openstack.fakes.stub_out_key_pair_funcs(stubs, have_key_pair=True)
-
nova.tests.api.openstack.fakes.stub_out_networking(stubs)
-
nova.tests.api.openstack.fakes.stub_out_rate_limiting(stubs)
-
nova.tests.api.openstack.fakes.wsgi_app(inner_app10=None, inner_app11=None, fake_auth=True, fake_auth_context=None)