Storage Volumes, Disks

Todo

rework after iSCSI merge (see ‘Old Docs’) (todd or vish)

The nova.volume.manager Module

The nova.volume.driver Module

Drivers for volumes.

class FakeISCSIDriver(*args, **kwargs)

Bases: nova.volume.driver.ISCSIDriver

Logs calls instead of executing.

FakeISCSIDriver.check_for_setup_error()

No setup necessary in fake mode.

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

Execute that simply logs the command.

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

Bases: nova.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.
ISCSIDriver.check_for_export(context, volume_id)

Make sure volume is exported.

ISCSIDriver.copy_image_to_volume(context, volume, image_service, image_id)

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

ISCSIDriver.copy_volume_to_image(context, volume, image_service, image_id)

Copy the volume to the specified image.

ISCSIDriver.create_export(context, volume)

Creates an export for a logical volume.

ISCSIDriver.ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

ISCSIDriver.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,
    }
}
ISCSIDriver.remove_export(context, volume)

Removes an export for a logical volume.

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

Bases: nova.volume.driver.VolumeDriver

Logs and records calls, for unit tests.

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

Logs the command.

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

Bases: nova.volume.driver.VolumeDriver

Implements RADOS block device (RBD) volume commands

RBDDriver.check_for_export(context, volume_id)

Make sure volume is exported.

RBDDriver.check_for_setup_error()

Returns an error if prerequisites aren’t met

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

Exports the volume

RBDDriver.create_snapshot(snapshot)

Creates an rbd snapshot

RBDDriver.create_volume(volume)

Creates a logical volume.

RBDDriver.create_volume_from_snapshot(volume, snapshot)

Creates a volume from a snapshot.

RBDDriver.delete_snapshot(snapshot)

Deletes an rbd snapshot

RBDDriver.delete_volume(volume)

Deletes a logical volume.

RBDDriver.ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

RBDDriver.initialize_connection(volume, connector)
RBDDriver.local_path(volume)

Returns the path of the rbd volume.

RBDDriver.remove_export(context, volume)

Removes an export for a logical volume

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

Bases: nova.volume.driver.VolumeDriver

Executes commands relating to Sheepdog Volumes

SheepdogDriver.check_for_export(context, volume_id)

Make sure volume is exported.

SheepdogDriver.check_for_setup_error()

Returns an error if prerequisites aren’t met

SheepdogDriver.create_export(context, volume)

Exports the volume

SheepdogDriver.create_snapshot(snapshot)

Creates a sheepdog snapshot

SheepdogDriver.create_volume(volume)

Creates a sheepdog volume

SheepdogDriver.create_volume_from_snapshot(volume, snapshot)

Creates a sheepdog volume from a snapshot.

SheepdogDriver.delete_snapshot(snapshot)

Deletes a sheepdog snapshot

SheepdogDriver.delete_volume(volume)

Deletes a logical volume

SheepdogDriver.ensure_export(context, volume)

Safely and synchronously recreates an export for a logical volume

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

Removes an export for a logical volume

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

Bases: object

Executes commands relating to Volumes.

VolumeDriver.attach_volume(context, volume_id, instance_uuid, mountpoint)

Callback for volume attached to instance.

VolumeDriver.check_for_export(context, volume_id)

Make sure volume is exported.

VolumeDriver.check_for_setup_error()

Returns an error if prerequisites aren’t met

VolumeDriver.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

VolumeDriver.copy_image_to_volume(context, volume, image_service, image_id)

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

VolumeDriver.copy_volume_to_image(context, volume, image_service, image_id)

Copy the volume to the specified image.

VolumeDriver.create_export(context, volume)

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

VolumeDriver.create_snapshot(snapshot)

Creates a snapshot.

VolumeDriver.create_volume(volume)

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

VolumeDriver.create_volume_from_snapshot(volume, snapshot)

Creates a volume from a snapshot.

VolumeDriver.delete_snapshot(snapshot)

Deletes a snapshot.

VolumeDriver.delete_volume(volume)

Deletes a logical volume.

VolumeDriver.detach_volume(context, volume_id)

Callback for volume detached.

VolumeDriver.do_setup(context)

Any initialization the volume driver does while starting

VolumeDriver.ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

VolumeDriver.get_volume_stats(refresh=False)

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

VolumeDriver.initialize_connection(volume, connector)

Allow connection to connector and return connection info.

VolumeDriver.local_path(volume)
VolumeDriver.remove_export(context, volume)

Removes an export for a logical volume.

VolumeDriver.set_execute(execute)
VolumeDriver.terminate_connection(volume, connector)

Disallow connection from connector

Tests

The volume_unittest Module

Old Docs

Nova uses ata-over-ethernet (AoE) to export storage volumes from multiple storage nodes. These AoE exports are attached (using libvirt) directly to running instances.

Nova volumes are exported over the primary system VLAN (usually VLAN 1), and not over individual VLANs.

AoE exports are numbered according to a “shelf and blade” syntax. In order to avoid collisions, we currently perform an AoE-discover of existing exports, and then grab the next unused number. (This obviously has race condition problems, and should be replaced by allocating a shelf-id to each storage node.)

The underlying volumes are LVM logical volumes, created on demand within a single large volume group.

Table Of Contents

Previous topic

The Database Layer

Next topic

Xen Storage Manager Volume Driver

This Page