Table Of Contents

Previous topic

The Database Layer

Next topic

Virtualization

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.

Storage Volumes, Disks

Todo

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

The nova.volume.manager Module

Volume manager manages creating, attaching, detaching, and persistent storage.

Persistant storage volumes keep their state independent of instances. You can attach to an instance, terminate the instance, spawn a new instance (even one from a different image) and re-attach the volume with the same data intact.

Related Flags

volume_topic:What rpc topic to listen to (default: volume).
volume_manager:The module name of a class derived from manager.Manager (default: nova.volume.manager.AOEManager).
storage_availability_zone:
 Defaults to nova.
volume_driver:Used by AOEManager. Defaults to nova.volume.driver.AOEDriver.
num_shelves:Number of shelves for AoE (default: 100).
num_blades:Number of vblades per shelf to allocate AoE storage from (default: 16).
volume_group:Name of the group that will contain exported volumes (default: nova-volumes)
aoe_eth_dev:Device name the volumes will be exported on (default: eth0).
num_shell_tries:
 Number of times to attempt to run AoE commands (default: 3)
class nova.volume.manager.VolumeManager(volume_driver=None, *args, **kwargs)

Bases: nova.manager.SchedulerDependentManager

Manages attachable block storage devices.

VolumeManager.check_for_export(context, instance_id)

Make sure whether volume is exported.

VolumeManager.create_snapshot(context, volume_id, snapshot_id)

Creates and exports the snapshot.

VolumeManager.create_volume(context, volume_id, snapshot_id=None)

Creates and exports the volume.

VolumeManager.delete_snapshot(context, snapshot_id)

Deletes and unexports snapshot.

VolumeManager.delete_volume(context, volume_id)

Deletes and unexports volume.

VolumeManager.init_host()

Do any initialization that needs to be run if this is a standalone service.

VolumeManager.notification(context, event)
VolumeManager.periodic_tasks(context=None)

Tasks to be run at a periodic interval.

VolumeManager.remove_compute_volume(context, volume_id)

Remove remote volume on compute host.

VolumeManager.setup_compute_volume(context, volume_id)

Setup remote volume on compute host.

Returns path to device.

The nova.volume.driver Module

Drivers for volumes.

class nova.volume.driver.AOEDriver(*args, **kwargs)

Bases: nova.volume.driver.VolumeDriver

WARNING! Deprecated. This driver will be removed in Essex. Its use is not recommended.

Implements AOE specific volume commands.

AOEDriver.check_for_export(context, volume_id)

Make sure volume is exported.

AOEDriver.create_export(context, volume)

Creates an export for a logical volume.

AOEDriver.discover_volume(context, _volume)

Discover volume on a remote host.

AOEDriver.ensure_export(context, volume)
AOEDriver.remove_export(context, volume)

Removes an export for a logical volume.

AOEDriver.undiscover_volume(_volume)

Undiscover volume on a remote host.

class nova.volume.driver.FakeISCSIDriver(*args, **kwargs)

Bases: nova.volume.driver.ISCSIDriver

Logs calls instead of executing.

FakeISCSIDriver.check_for_setup_error()

No setup necessary in fake mode.

FakeISCSIDriver.discover_volume(context, volume)

Discover volume on a remote host.

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

Execute that simply logs the command.

FakeISCSIDriver.undiscover_volume(volume)

Undiscover volume on a remote host.

class nova.volume.driver.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.create_export(context, volume)

Creates an export for a logical volume.

ISCSIDriver.discover_volume(context, volume)

Discover volume on a remote host.

ISCSIDriver.ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

ISCSIDriver.remove_export(context, volume)

Removes an export for a logical volume.

ISCSIDriver.set_execute(execute)
ISCSIDriver.undiscover_volume(volume)

Undiscover volume on a remote host.

class nova.volume.driver.LoggingVolumeDriver(execute=<function execute at 0x853f72c>, *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.discover_volume(context, volume)
LoggingVolumeDriver.ensure_export(context, volume)
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.undiscover_volume(volume)
class nova.volume.driver.RBDDriver(execute=<function execute at 0x853f72c>, *args, **kwargs)

Bases: nova.volume.driver.VolumeDriver

Implements RADOS block device (RBD) volume commands

RBDDriver.check_for_setup_error()

Returns an error if prerequisites aren’t met

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.delete_snapshot(snapshot)

Deletes an rbd snapshot

RBDDriver.delete_volume(volume)

Deletes a logical volume.

RBDDriver.discover_volume(context, volume)

Discover volume on a remote host

RBDDriver.ensure_export(context, volume)

Synchronously recreates an export for a logical volume.

RBDDriver.local_path(volume)

Returns the path of the rbd volume.

RBDDriver.remove_export(context, volume)

Removes an export for a logical volume

RBDDriver.undiscover_volume(volume)

Undiscover volume on a remote host

class nova.volume.driver.SheepdogDriver(execute=<function execute at 0x853f72c>, *args, **kwargs)

Bases: nova.volume.driver.VolumeDriver

Executes commands relating to Sheepdog Volumes

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.discover_volume(context, volume)

Discover volume on a remote host

SheepdogDriver.ensure_export(context, volume)

Safely and synchronously recreates an export for a logical volume

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

Removes an export for a logical volume

SheepdogDriver.undiscover_volume(volume)

Undiscover volume on a remote host

class nova.volume.driver.VolumeDriver(execute=<function execute at 0x853f72c>, *args, **kwargs)

Bases: object

Executes commands relating to Volumes.

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.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.discover_volume(context, volume)

Discover volume on a remote host.

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.local_path(volume)
VolumeDriver.remove_export(context, volume)

Removes an export for a logical volume.

VolumeDriver.set_execute(execute)
VolumeDriver.undiscover_volume(volume)

Undiscover volume on a remote host.

class nova.volume.driver.ZadaraBEDriver(*args, **kwargs)

Bases: nova.volume.driver.ISCSIDriver

Performs actions to configure Zadara BE module.

ZadaraBEDriver.check_for_setup_error()

No setup necessary for Zadara BE.

ZadaraBEDriver.create_export(context, volume)

create BE export for a volume

ZadaraBEDriver.create_snapshot(snapshot)

Nothing required for snapshot

ZadaraBEDriver.create_volume(volume)

Creates BE volume.

ZadaraBEDriver.delete_snapshot(snapshot)

Nothing required to delete a snapshot

ZadaraBEDriver.delete_volume(volume)

Deletes BE volume.

ZadaraBEDriver.ensure_export(context, volume)

ensure BE export for a volume

ZadaraBEDriver.get_volume_stats(refresh=False)

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

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

Removes BE export for a volume.

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.