Table Of Contents

Previous topic

Scheduler

Next topic

Common and Misc Libraries

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.

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.

The nova.virt.fake Module

The nova.auth.fakeldap Module

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.

The nova.fakerabbit Module

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()

The nova.volume.driver.FakeAOEDriver Class

The nova.tests.service_unittest.FakeManager Class

The nova.tests.api.openstack.fakes Module