Previous topic

The cinder.volume.api Module

Next topic

The cinder.volume.iscsi Module

This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Cinder 2011.2 docs or all OpenStack docs too.

The cinder.volume.driver Module

Drivers for volumes.

class FakeISCSIDriver(*args, **kwargs)

Bases: cinder.volume.driver.ISCSIDriver

Logs calls instead of executing.

check_for_setup_error()

No setup necessary in fake mode.

static fake_execute(cmd, *_args, **_kwargs)

Execute that simply logs the command.

initialize_connection(volume, connector)
terminate_connection(volume, connector)
class ISCSIDriver(*args, **kwargs)

Bases: cinder.volume.driver.VolumeDriver

Executes commands relating to ISCSI volumes.

We make use of model provider properties as follows:

provider_location
if present, contains the iSCSI target information in the same format as an ietadm discovery i.e. ‘<ip>:<port>,<portal> <target IQN>’
provider_auth
if present, contains a space-separated triple: ‘<auth method> <auth username> <auth password>’. CHAP is the only auth_method in use at the moment.
check_for_export(context, volume_id)

Make sure volume is exported.

copy_image_to_volume(context, volume, image_service, image_id)

Fetch the image from image_service and write it to the volume.

copy_volume_to_image(context, volume, image_service, image_id)

Copy the volume to the specified image.

create_export(context, volume)

Creates an export for a logical volume.

ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

initialize_connection(volume, connector)

Initializes the connection and returns connection info.

The iscsi driver returns a driver_volume_type of ‘iscsi’. The format of the driver data is defined in _get_iscsi_properties. Example return value:

{
    'driver_volume_type': 'iscsi'
    'data': {
        'target_discovered': True,
        'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
        'target_portal': '127.0.0.0.1:3260',
        'volume_id': 1,
    }
}
remove_export(context, volume)

Removes an export for a logical volume.

set_execute(execute)
terminate_connection(volume, connector)
class LoggingVolumeDriver(execute=<function execute at 0x9ea0b8c>, *args, **kwargs)

Bases: cinder.volume.driver.VolumeDriver

Logs and records calls, for unit tests.

static all_logs()
check_for_export(context, volume_id)
check_for_setup_error()
static clear_logs()
create_export(context, volume)
create_volume(volume)
delete_volume(volume)
ensure_export(context, volume)
initialize_connection(volume, connector)
local_path(volume)
static log_action(action, parameters)

Logs the command.

static logs_like(action, **kwargs)
remove_export(context, volume)
terminate_connection(volume, connector)
class RBDDriver(execute=<function execute at 0x9ea0b8c>, *args, **kwargs)

Bases: cinder.volume.driver.VolumeDriver

Implements RADOS block device (RBD) volume commands

check_for_export(context, volume_id)

Make sure volume is exported.

check_for_setup_error()

Returns an error if prerequisites aren’t met

clone_image(volume, image_location)
copy_image_to_volume(context, volume, image_service, image_id)
create_export(context, volume)

Exports the volume

create_snapshot(snapshot)

Creates an rbd snapshot

create_volume(volume)

Creates a logical volume.

create_volume_from_snapshot(volume, snapshot)

Creates a volume from a snapshot.

delete_snapshot(snapshot)

Deletes an rbd snapshot

delete_volume(volume)

Deletes a logical volume.

ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

initialize_connection(volume, connector)
local_path(volume)

Returns the path of the rbd volume.

remove_export(context, volume)

Removes an export for a logical volume

terminate_connection(volume, connector)
class SheepdogDriver(execute=<function execute at 0x9ea0b8c>, *args, **kwargs)

Bases: cinder.volume.driver.VolumeDriver

Executes commands relating to Sheepdog Volumes

check_for_export(context, volume_id)

Make sure volume is exported.

check_for_setup_error()

Returns an error if prerequisites aren’t met

create_export(context, volume)

Exports the volume

create_snapshot(snapshot)

Creates a sheepdog snapshot

create_volume(volume)

Creates a sheepdog volume

create_volume_from_snapshot(volume, snapshot)

Creates a sheepdog volume from a snapshot.

delete_snapshot(snapshot)

Deletes a sheepdog snapshot

delete_volume(volume)

Deletes a logical volume

ensure_export(context, volume)

Safely and synchronously recreates an export for a logical volume

initialize_connection(volume, connector)
local_path(volume)
remove_export(context, volume)

Removes an export for a logical volume

terminate_connection(volume, connector)
class VolumeDriver(execute=<function execute at 0x9ea0b8c>, *args, **kwargs)

Bases: object

Executes commands relating to Volumes.

attach_volume(context, volume_id, instance_uuid, mountpoint)

Callback for volume attached to instance.

check_for_export(context, volume_id)

Make sure volume is exported.

check_for_setup_error()

Returns an error if prerequisites aren’t met

clone_image(volume, image_location)

Create a volume efficiently from an existing image.

image_location is a string whose format depends on the image service backend in use. The driver should use it to determine whether cloning is possible.

Returns a boolean indicating whether cloning occurred

copy_image_to_volume(context, volume, image_service, image_id)

Fetch the image from image_service and write it to the volume.

copy_volume_to_image(context, volume, image_service, image_id)

Copy the volume to the specified image.

create_export(context, volume)

Exports the volume. Can optionally return a Dictionary of changes to the volume object to be persisted.

create_snapshot(snapshot)

Creates a snapshot.

create_volume(volume)

Creates a logical volume. Can optionally return a Dictionary of changes to the volume object to be persisted.

create_volume_from_snapshot(volume, snapshot)

Creates a volume from a snapshot.

delete_snapshot(snapshot)

Deletes a snapshot.

delete_volume(volume)

Deletes a logical volume.

detach_volume(context, volume_id)

Callback for volume detached.

do_setup(context)

Any initialization the volume driver does while starting

ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

get_volume_stats(refresh=False)

Return the current state of the volume service. If ‘refresh’ is True, run the update first.

initialize_connection(volume, connector)

Allow connection to connector and return connection info.

local_path(volume)
remove_export(context, volume)

Removes an export for a logical volume.

set_execute(execute)
terminate_connection(volume, connector)

Disallow connection from connector