Fake Drivers

Fake Drivers

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 fake_compute Module

class API

Bases: object

Fake Compute API.

add_security_group_to_server(*args, **kwargs)
image_list(*args, **kwargs)
instance_volume_attach(ctx, server_id, volume_id, mount_path)
instance_volume_detach(ctx, server_id, volume_id)
instance_volumes_list(ctx, server_id)
keypair_delete(*args, **kwargs)
keypair_import(*args, **kwargs)
keypair_list(*args, **kwargs)
security_group_create(*args, **kwargs)
security_group_list(*args, **kwargs)
security_group_rule_create(*args, **kwargs)
server_create(*args, **kwargs)
server_delete(*args, **kwargs)
server_get(*args, **kwargs)
server_get_by_name_or_id(*args, **kwargs)
server_reboot(*args, **kwargs)
class FakeImage(**kwargs)

Bases: object

class FakeKeypair(**kwargs)

Bases: object

class FakeSecurityGroup(**kwargs)

Bases: object

class FakeServer(**kwargs)

Bases: object

get(attr, default)
update(*args, **kwargs)

The fake_driver Module

class FakeShareDriver(*args, **kwargs)

Bases: manila.share.driver.ShareDriver

Fake share driver.

This fake driver can be also used as a test driver within a real running manila-share instance. To activate it use this in manila.conf:

enabled_share_backends = fake

[fake]
driver_handles_share_servers = True
share_backend_name = fake
share_driver = manila.tests.fake_driver.FakeShareDriver

With it you basically mocked all backend driver calls but e.g. networking will still be activated.

allow_access(context, share, access, share_server=None)
create_share(context, share, share_server=None)
create_share_from_snapshot(context, share, snapshot, share_server=None)
create_share_group(context, group_id, share_server=None)
create_snapshot(context, snapshot, share_server=None)
delete_share(context, share, share_server=None)
delete_share_group(context, group_id, share_server=None)
delete_snapshot(context, snapshot, share_server=None)
deny_access(context, share, access, share_server=None)
do_setup(context)
driver_handles_share_servers
ensure_share(context, share, share_server=None)
get_network_allocations_number()
get_share_stats(refresh=False)
manage_existing(share, driver_options)
setup_server(*args, **kwargs)
teardown_server(*args, **kwargs)
unmanage(share)

The fake_network Module

class FakeNeutronNetworkHelper

Bases: object

setup_connectivity_with_service_instances()
class FakeServiceInstanceManager(*args, **kwargs)

Bases: object

get_service_instance(context, share_network_id, create=True)
network_helper

The fake_utils Module

This modules stubs out functions in manila.utils.

fake_execute(*cmd_parts, **kwargs)

This function stubs out execute.

It optionally executes a preconfigued function to return expected data.

fake_execute_clear_log()
fake_execute_default_reply_handler(*ignore_args, **ignore_kwargs)

A reply handler for commands that haven’t been added to the reply list.

Returns empty strings for stdout and stderr.

fake_execute_get_log()
fake_execute_set_repliers(repliers)

Allows the client to configure replies to commands.

get_fake_lock_context()
stub_out_utils_execute(testcase)

The fake_volume Module

class API

Bases: object

Fake Volume API.

create(*args, **kwargs)
create_snapshot_force(*args, **kwargs)
delete(volume_id)
delete_snapshot(*args, **kwargs)
extend(*args, **kwargs)
get(*args, **kwargs)
get_all(search_opts)
get_all_snapshots(search_opts)
get_snapshot(*args, **kwargs)
class FakeVolume(**kwargs)

Bases: object

class FakeVolumeSnapshot(**kwargs)

Bases: object

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.