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.
fake_compute
Module¶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)FakeImage
(**kwargs)Bases: object
FakeKeypair
(**kwargs)Bases: object
FakeSecurityGroup
(**kwargs)Bases: object
FakeServer
(**kwargs)Bases: object
get
(attr, default)update
(*args, **kwargs)fake_driver
Module¶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)Allow access to the share.
create_share
(context, share, share_server=None)Is called to create share.
create_share_from_snapshot
(context, share, snapshot, share_server=None)Is called to create share from snapshot.
create_share_group
(context, group_id, share_server=None)Create a share group.
Parameters: |
|
---|---|
Returns: | (share_group_model_update, share_update_list) share_group_model_update - a dict containing any values to be updated for the SG in the database. This value may be None. |
create_snapshot
(context, snapshot, share_server=None)Is called to create snapshot.
Parameters: |
|
---|---|
Returns: | None or a dictionary with key ‘export_locations’ containing a list of export locations, if snapshots can be mounted. |
delete_share
(context, share, share_server=None)Is called to remove share.
delete_share_group
(context, group_id, share_server=None)Delete a share group
Parameters: |
|
---|---|
Returns: | share_group_model_update share_group_model_update - a dict containing any values to be updated for the group in the database. This value may be None. |
delete_snapshot
(context, snapshot, share_server=None)Is called to remove snapshot.
Parameters: |
|
---|
deny_access
(context, share, access, share_server=None)Deny access to the share.
do_setup
(context)Any initialization the share driver does while starting.
driver_handles_share_servers
ensure_share
(context, share, share_server=None)Invoked to ensure that share is exported.
Driver can use this method to update the list of export locations of the share if it changes. To do that, you should return list with export locations.
Returns: | None or list with export locations |
---|
get_network_allocations_number
()Returns number of network allocations for creating VIFs.
Drivers that use Nova for share servers should return zero (0) here same as Generic driver does. Because Nova will handle network resources allocation. Drivers that handle networking itself should calculate it according to their own requirements. It can have 1+ network interfaces.
get_share_stats
(refresh=False)Get share status.
If ‘refresh’ is True, run update the stats first.
manage_existing
(share, driver_options, share_server=None)Brings an existing share under Manila management.
If the provided share is not valid, then raise a ManageInvalidShare exception, specifying a reason for the failure.
If the provided share is not in a state that can be managed, such as being replicated on the backend, the driver MUST raise ManageInvalidShare exception with an appropriate message.
The share has a share_type, and the driver can inspect that and compare against the properties of the referenced backend share. If they are incompatible, raise a ManageExistingShareTypeMismatch, specifying a reason for the failure.
This method is invoked when the share is being managed with
a share type that has driver_handles_share_servers
extra-spec set to False.
Parameters: |
|
---|---|
Returns: | share_update dictionary with required key ‘size’, which should contain size of the share. |
setup_server
(*args, **kwargs)teardown_server
(*args, **kwargs)unmanage
(share, share_server=None)Removes the specified share from Manila management.
Does not delete the underlying backend share.
For most drivers, this will not need to do anything. However, some drivers might use this call as an opportunity to clean up any Manila-specific configuration that they have associated with the backend share.
If provided share cannot be unmanaged, then raise an UnmanageInvalidShare exception, specifying a reason for the failure.
This method is invoked when the share is being unmanaged with
a share type that has driver_handles_share_servers
extra-spec set to False.
fake_network
Module¶FakeNeutronNetworkHelper
Bases: object
setup_connectivity_with_service_instances
()FakeServiceInstanceManager
(*args, **kwargs)Bases: object
get_service_instance
(context, share_network_id, create=True)network_helper
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)fake_volume
Module¶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)FakeVolume
(**kwargs)Bases: object
FakeVolumeSnapshot
(**kwargs)Bases: object
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.